|
|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Feb 2006
Posts: 12
|
How to ensure random external swf is fully loaded before moving to new frame [F8]
I am randomly loading external swfs into my main movie. I've got the random part working. However, I don't know how to make sure the random swf is fully loaded before jumping to a specific frame in my main movie.
I have a preloader inside each external swf, but I don't know how to make my main movie understand that the random swf is completely loaded before the main timeline should gotoandPlay("start"). What I Have So Far: I have a blank MC (named "location") on the main stage, which I am using to hold the random swfs. On the first frame inside this MC, I have the following code: choice = Math.round(Math.random()*2); switch (choice) { case 0 : location.loadMovie("image0.swf"); break; case 1 : location.loadMovie("image1.swf"); break; case 2 : location.loadMovie("image2.swf"); break; } Loading the random swfs is working perfectly. But after the external swf is fully loaded, I want to move onto a frame labeled "start" on the main stage. I just don't know how to make sure the random swfs are completely loaded before I say gotoandPlay("start"). I've tried piecing together bits from so many tutorials, and I just don't know what I need to do to make it work with my current code. Thanks so much! Last edited by lsterling03; 08-28-2007 at 01:33 PM. Reason: edited to include flash version |
|
|
|
|
|
#2 |
|
I want my 2 dollars
Join Date: Mar 2007
Location: Bakersfield
Posts: 2,044
|
instead of using loadMovie you can use the MovieClipLoader class that has the onLoadInit function that checks if an external swf is loaded including it's actions.
var mcl:MovieClipLoader = new MovieClipLoader; choice = Math.round(Math.random()*2); switch (choice) { case 0 : location.loadClip("image0.swf"); break; case 1 : location.loadClip("image1.swf"); break; case 2 : location.loadClip("image2.swf"); break; default ://add a default in case the switch fails for some reason location.loadClip("image0.swf"); break; } mcl.onLoadInit = function(){ //add the actions you want to happen when the movie is loaded } mcl.addListener(this);
__________________
http://www.mneilsworld.com/ Text Effects | Bubbles | Dynamic Resize 4 weeks , 20 papers ... thats 2 dollars .....Caassshhh! Last edited by mneil; 08-28-2007 at 02:51 PM. Reason: you should add a default to your switch |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Feb 2006
Posts: 12
|
Thanks for your help!
I tried the code you provided, and I received an error saying "there is no property with the name 'onloadInit'. Do you know what the problem is? Thank you! |
|
|
|
|
|
#4 |
|
I want my 2 dollars
Join Date: Mar 2007
Location: Bakersfield
Posts: 2,044
|
sorry I always construct it wrong and forget the object:
var mcLoader:Object = new Object(); choice = Math.round(Math.random()*2); switch (choice) { case 0 : mcl.loadClip("image0.swf", loacation); break; case 1 : mcl.loadClip("image1.swf", loacation); break; case 2 : mcl.loadClip("image2.swf", loacation); break; default ://add a default in case the switch fails for some reason mcl.loadClip("image0.swf", loacation); break; } mcListener.onLoadInit = function(){ //add the actions you want to happen when the movie is loaded } var mcl:MovieClipLoader = new MovieClipLoader; mcl.addListener(mcLoader);
__________________
http://www.mneilsworld.com/ Text Effects | Bubbles | Dynamic Resize 4 weeks , 20 papers ... thats 2 dollars .....Caassshhh! |
|
|
|
![]() |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|