This content has been marked as final. Show 18 replies
at the end of Animation01 check if animation02 has completed loading. if so, start its play. if not, assign a boolean variable to true so in animation02's onLoadInit (not onLoadComplete) method if starts play.
Hi, kglad! Thanks for your input. Let's see if I get this straight. In addition to the variable in each of the two movies, I can add one more ("doneLoading"). I set this to true in the onLoadInit event handler. Then I play the first movie straight out. For the second movie, I test whether it's done loading and the first movie done playing before running it.
I'm going to try it now. I'll post back my results.
you don't anything in addition to what i described. basically, one of those two events will occur last: either animation01 completes play last (and animation02 is ready to go) or animation02 loads last and is ready to play.1 person found this helpful
Kglad, your suggestion did not work (or I still didn't understand you.)
Ok, my deadline is tomorrow (it's 2am now)... ouch. One thing I realized is that the previous code I posted is needlessly complex, as it takes an arbitrary number of movies to preload. This is dumb because I only want to preload two movies. So, I tried simplifying it a bit. Following is the logical concept of the movies I have:
|___FrontEnd-Ext-v16.swf (first movie to preload)
|___Mesozoic_Animation-v32.swf (second movie to preload)
Now it seems I have two problems. My handlers are not getting called on the INIT event of the Loaders. Also I can't seem to access the Loader.content so I can do something like mcLoaderOne.content.stop(). Some one, kindly tell me where in my code I'm making the mistake(s).
FYI - This is pertaining to ActionScript 3. My goal is to preload one move then play it automatically. While the first move plays, the second movie will be preloaded into cache. When the first movie finishes playing and the second movie is done loading, then play the second movie. Here's the new code I've written.
Just noticed the typo on the argument names of both event handlers. I've corrected this but I am still in the same boat. The first movie loads but I can't see it. I know it is loading because I can hear its sound track. The second movie doesn't load at all, of course. :(
Some one please help or put me out of my misery. lol
that's not going to work. there are many problems with the logic.
when animation02 is done loading check if animation01 is done playing (ie, put mcLoaderOne.content.currentFrame == mcLoaderOne.content.totalFrames in your onInitTwo() function) . if yes, remove animation01 and start animation02.
if no, either start a loop to check when animation01 completes play (and then remove animation01 and start animation02) or dispatch an event when animation01 completes play and in that event handler check if animation02 has completed loading (if yes, remove animation01 and start animation02; if no, then the code described in the first paragraph will trigger the events you want.)
Hey, Kglad -- You remind me a lot of my martial arts teacher in the way you explain things. lol
I understand what I need to do, according to your posting. There's still one issue my friend and that is the first movie is loading (but not displaying) yet my first init handler is not getting called. Can you, or any one else, tell my why this is?
Thank you so much for your assistance. I've seen so many questions on this topic that I want to post the final working code so we are just a little bit more enlightened. :D
the init event occurs when loading is complete and all the methods and properties of the loading file are available.
the open event occurs when loading starts.
Hi again -- Ok, I get it that INIT event triggers when the movie is done loading, COMPLETE when the loaded movie's playhead is finished with the last frame. Thing is that I know the first movie is being loaded (have a trace call from within and see it in output fine.) However, the INIT handler is not getting triggered nor the COMPLETE event. Further, I can't seem to access the movie which has been loaded (example, mcLoaderOne.content.gotoAndPlay(2)).
If I can get the events to trigger the handlers for the first movie, I can figure out the rest. Same with being able to send messages to the loaded movie.
Here's how I've modified the events and handlers:
oh, the loader class doesn't have those events. the loader's contentLoaderInfo property has those events.
Kglad -- Totally makes sense and the events are now triggering correctly. For every one's benefit, below is the working code.
One thing I noticed is the COMPLETE event is not what is triggered once the movie finishes playing. It triggers immediately right after the INIT event is fired. Lastly is that I still can't seem to talk to my loaded movie with mcLoader.content.gotoAndPlay(2)
Darn, obviously the code example should not have the bold tags tags... :S
are you executing your mcLoader.content.gotoAndPlay(2) statement in one of the oncomplete or oninit functions?1 person found this helpful
Man, I feel like I've come a long way since my first posting, thanks to you and some heavy googling + experimenting. Here's the status of things, as I've modified the code a lot. Good news is that I can get the first movie loaded and start playing. I can get the second movie to start loading also. Further, I can also track when the first movie finishes playing and add the second movie. The only thing remaining is getting the second movie to play.
Here's my code. Although certain things could be coded better, I feel 95% of it works now. Kglad, I commented the two parts that seem not to be working.
i'd say that's a bit much. it was easier to write the code than to debug your code:
Hahaha... you're so right, kglad. Your code is much more concise. Let me try it out and will post in a bit.
Thanks again for all your support.
you're welcome.1 person found this helpful
Kglad, just wanted to thank you for your consistent assistance. Your code worked very well. I only added the this.addChild() where needed for both Loader instances. I'm going to check out your site too, dude.
Have a great day.