Jump to content
Search Community

OnchildComplete not firing

alflasy test
Moderator Tag

Recommended Posts

Thanks Carl, Great reply. All my problems are fixed with the below code in course.fla

 

 

function onInit(e:LoaderEvent):void{
    //note module2.swf will be behind module.swf
    addChild(LoaderMax.getContent("module2.swf"));
    addChild(LoaderMax.getContent("module.swf"));
    addChild(bar);
    }
    


function completeHandler(e:LoaderEvent):void{
    trace("courseXMLLoader *** COMPLETE ***");
    //trace(e.target.content)
    } 
 

 

     

 

Now I get the stage and the onComplete event  is fired last. Still have few question.

 

As you said I don't have to use the image holder and I agree, that's the power of LOADERMAX, but still I need to use it as I have lot of content that needs to stay with the image and it shows and hide off the stage when needed. So I use image holder to keep image and its content together. I am still using the image holder with the above code and all looks to work fine. Do you think its loading the image multiple times? 

 

Another question is about about hardcoding the module.swf file name in onInit function. I don't want to do that. I want to have the freedom of using any file name and get that name from course.xml. I am loading mulitple SWFs from course.xml. May be I can set all the file name in array and loop through the array and call addChild. Are there better options with in LoaderMax.

 

Also thanks for encouragement. I always get in to these kind of challenging issues and I enjoys that as I am learning new things from it. I have been looking at LoaderMax for quit some time but this is the first time I am using it and its already getting so interesting. Lets see what challenge I face next.

 

 

Thank you

Link to comment
Share on other sites

No I don't think your images are being loaded multiple times. 

 

in the onInit handler you can parse the xml to look for the url or name properties of your SWFLoaders OR if your course.xml has the SWFLoaders defined inside a LoaderMax node you can target that LoaderMax, loop through its children and add their content to the stage.

 

to target the xml in side the onInit handler you can use

 

 

 

 

function onInit(e:LoaderEvent):void{
    var loadedXML:XML = e.target.contet;


//add code to find SWFLoaders or a LoaderMax in the xml
   
   
    }
 

 

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