Search code examples
actionscript-3loadloadermovieclipaddchild

AS3: How will I find movieclips name of external swf which is loaded inside a movieclip.movieclip?


I've loaded a swf inside a movieclip which is inside another movieclip.

frame.pageLoader.addChild(intoMC)

Here's the code:

 frame.visible = true;

var bookImagePath: String = "file://" + File.userDirectory.nativePath.toString() + "/Books/" + someFoldername + "/Home.swf";
trace(bookImagePath);



var intoMC: Loader = new Loader;

intoMC.load(new URLRequest(bookImagePath));

frame.pageLoader.addChild(intoMC)

Now, this Home.swf has some movieclips with random names(Ex: triger, boat, rain), which I want make as button.

Need help here...


Solution

  • I tried something like this. And this worked.

    var someMC: MovieClip
    
    var intoMC: Loader = new Loader;
    
    intoMC.contentLoaderInfo.addEventListener(Event.COMPLETE, PageLoad);
    
    intoMC.load(new URLRequest(bookImagePath));
    
    
    function PageLoad(e: Event): void {
    
        someMC = e.target.content as MovieClip;;
    
        displayFrame.pageLoader.addChild(intoMC)
    }
    

    Is there any other way?