Jump to content
Search Community

hit a mc after a SWFLoader

o6low test
Moderator Tag

Recommended Posts

Hello Jacks,

 

I have a basic question to.

 

I'm loading a swf "visuels" which contain movieClip "mc" on its stage with this code :

 

var queue:LoaderMax = new LoaderMax({name:"mainQueue", onComplete:_completeHandler});
queue.append( new SWFLoader("medias/visuels.swf", {name:"visuels", estimatedBytes:800000}) );
queue.load();

 

in _completeHandler I have to reach "mc". But i just have queue.getContent("visuels") which is a LoaderContent type.

 

And when i do this :

 

var mcLoaded:Movieclip = queue.getContent("visuels") as MovieClip;
mcLoaded.mc.alpha  = 0; (for exemple)

 

I can't reach mc... (error)

 

I try queue.getContent("visuels").mc.alpha = 0 and i have the same problem...

 

I think i miss something, how can i do that ?

 

Sorry for the language & great jobs for the greenSock Project !! =)

Link to comment
Share on other sites

Remember, the "content" of a SWFLoader refers to its ContentDisplay object which is a Sprite into which the raw swf is loaded. You need to reference the SWFLoader's "rawContent" to refer to the swf's root. Please read tip #1 at http://www.greensock.com/loadermax-tips/

 

var mc:MovieClip = LoaderMax.getLoader("visuels").rawContent.mc;

 

Since your "mc" is at the root level, SWFLoader has a convenient "getSWFChild()" method that you could use, like this:

 

var mcLoaded:MovieClip = LoaderMax.getLoader("visuels").getSWFChild("mc") as MovieClip;

Link to comment
Share on other sites

  • 5 months later...

this also will do the trick:

 

consider "top_icon" is your child

 

var image:ContentDisplay = LoaderMax.getContent(loaderName);

var mcLoaded_topIcon:MovieClip = MovieClip( (image.rawContent).top_icon );

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