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:
- I drew a square in flash
- Made it into a symbol
- made sure to check the "Extract for Action Script"
- to doubly check I created an instance of it from within the asset file.
- went to my loader file
- loaded the assets.swf
- tried to find the class variable using "getDefininition"
- 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.