Jump to content
Search Community

Accessing loaded SWFs via the container

neuralism test
Moderator Tag

Recommended Posts

Hello,

 

I've loaded some SWFs into a container and need to access the SWFs via the container itself. How should I go about it?

 

loader.append(new SWFLoader("my.swf"), { onComplete: completeHandler, container: myMovieClip} ));

 

Let's say I'm now working in the DocumentClass or the timeline of myMovieClip. How do I go about accessing the content that has been loaded onto its stage?

 

Thanks!

Link to comment
Share on other sites

I assume you're talking about the loader's rawContent which would refer to the subloaded swf's root (unless security problems were encountered in which case rawContent will refer to a Loader object instead).

 

var loader:SWFLoader = new SWFLoader("child.swf", {name:"mySWF", onComplete:completeHandler});
loader.load();
function completeHandler(event:LoaderEvent):void {
   var swfRoot:MovieClip = loader.rawContent; //assuming your swf's document class extends MovieClip
}

 

Of course if you want to get the loader by name or URL from anywhere, you could do:

 

var loader:SWFLoader = LoaderMax.getLoader("mySWF");

 

And then you can get the rawContent.

 

Does that answer your question?

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...