views:

27

answers:

1

I'v been searching online for 5 hours, trying every example I see now. I simply can't take it anymore. The task is seemingly simple, but in application is next to impossible from my experience.

I am trying to load assets from an external swf. As in:

  1. I drew a square in flash
  2. Made it into a symbol
  3. made sure to check the "Extract for Action Script"
  4. to doubly check I created an instance of it from within the asset file.
  5. went to my loader file
  6. loaded the assets.swf
  7. tried to find the class variable using "getDefininition"
  8. FAILED.

from what I'v been seeing from around the web the following code should work. (I actually copied it word for word from one of the tutorials) but it doesn't work.

import flash.system.ApplicationDomain;
import flash.display.MovieClip;

var myLoader:Loader = new Loader();
var myUrlReq:URLRequest = new URLRequest("Assets.swf");
myLoader.load(myUrlReq);
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded);

function onLoaded(event:Event):void{

 var Square:Class = event.target.applicationDomain.getDefinition("XIconG") as Class;
 var mySquare:MovieClip = new Square() as MovieClip;

 addChild(mySquare);
}

it always gives me this error

    ReferenceError: Error #1065: Variable XIconG is not defined.
 at flash.system::ApplicationDomain/getDefinition()
        at assetloader_fla::MainTimeline/onLoaded()

there should definately be class definition for XIconG though because I tried it myself from within the Asset.swf file. also I'm not sure whether this helps you, but when I tried to debug, I looked at the event.target.applicationDomain variable from the debugger menu and under it it said domainMemory = null. I don't have a clue why that is though.

I BEG YOU someone help me. Just point me in any direction.

A: 

UGGGHGHHGHG !!! I FIGURED IT OUT...STUPID TLF TEXT...

ok, so in my desperation I literally deleted one object at a time from my library and tested (and i have over 30). The culprit seems to be the new TLF text. One of my objects contained it, and apparently having even one of those, (even if your not using it later) nullifies the entire file. The second I switched it back to Classic Text, everything worked. Now how was ANYONE supposed to know that?!?!

All I can say is, I can finally sleep now.

Thank you everybody. And I hope this post helps someone out there like me.