Jump to content
Search Community

SWFLoader: adding content to the stage

jknouse test
Moderator Tag

Recommended Posts

Sorry if this is obvious. I am using LoaderMax to create a load queue, but I am not using the 'container' parameter to add them to the stage immediately. However, I'm not easily finding how to add the swf's to the stage at a later time. I think this must be something obvious, but I'm a bit of a knucklehead, soooo...

 

BTW, thanks so much for everything you've done. I use your brain children on literally everything.

Link to comment
Share on other sites

Ha ha. Well, just for the sake of others who may have the same question, I'll give a slightly more thorough answer even though you already figured it out: You can get the loader's content ANYTIME using its "content" property or just use the static LoaderMax.getContent() to get it based on its name or URL. Like:

 

var loader:SWFLoader = new SWFLoader("main.swf", {name:"mySWF"});

//then later...
var content:ContentDisplay = loader.content;
//-OR-
var content:ContentDisplay = LoaderMax.getContent("mySWF");
//-OR-
var content:ContentDisplay = LoaderMax.getContent("main.swf");

 

Those will return the ContentDisplay Sprite that houses the swf when it gets loaded, but if you want to get the swf's root itself, you can use the rawContent property of the SWFLoader but that will ONLY work after it has loaded so you could use an onComplete like:

 

var loader:SWFLoader = new SWFLoader("main.swf", {onComplete:completeHandler});
function completeHandler(event:LoaderEvent):void {
   var swf:MovieClip = event.target.rawContent;
}

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.
×
×
  • Create New...