Jump to content
GreenSock

Saad

how to access flash.display.Loader used by the SWFLoader

Recommended Posts

I'm trying to get hold of flash.display.Loader used by the SWFLoader in order to manually instantiate/setup the custom document class used by the SWF.

 

typically in as3, we'd use flash.display.Loader as below.

var className:String = getQualifiedClassName(loader.content);
var classRef:Class = loader.contentLoaderInfo.applicationDomain.getDefinition(className) as Class;
var captureModule = new classRef();
addChild(captureModule as DisplayObject);

LoaderMax routine

loaderMax.append(new SWFLoader("capture.swf", {name:"capture"}));

completeHandler, stuck at trying to get the loader object, seems it's private. Any suggestions please?

function completeHandler(event:LoaderEvent): void {
	var className:String = getQualifiedClassName(loaderMax.getContent("capture").rawContent);
	var loader = loaderMax.getLoader("capture"); //It's SWFLoader
	//var classRef:Class = loader.contentLoaderInfo.applicationDomain.getDefinition(className) as Class;
	//trace(classRef);
}
Link to comment
Share on other sites

Got it...

var className:String = getQualifiedClassName(loaderMax.getContent("capture").rawContent);
var loader = loaderMax.getContent("capture").rawContent.loaderInfo.loader;
var classRef:Class = loader.contentLoaderInfo.applicationDomain.getDefinition(className) as Class;
trace(classRef);
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×