Groups | Blog | Home
all groups > flash actionscript > july 2007 >

flash actionscript : Frame Count for dynamic SWFs?


cconcannon
7/30/2007 11:04:17 PM
I have made several separate SWF movies using Captivate and I want to compile
and create a continuous playback in flash. I tried using a loadMovie which, of
course, loads the first movie fine. But how do I let Flash know when it's done
playing to load the second one? I thought I'd get a frame count of the loaded
SWF movie, but all I can figure out is to get a frame count of the current
timeline, not the loaded SWF.
Is there a way to automatically load one SWF after another in a continuous
playback? I have no way of inserting any variables into the SWFs since they
were made in Captivate and not Flash.

kglad
7/30/2007 11:20:30 PM
cconcannon
7/31/2007 7:48:15 PM
"the host swf should be able to monitor the _currentframe of the loaded captive
swf and compare that to the loaded swf's _totalframes. "

That's exactly what I want it to do! Unfortunately, the on-line Help section
is pretty useless on explaining how. It only sites the _root as an example
getting a _currentframe or _totalframe. I thought something like:
if
(myMovie_mc[loadedmovie.swf]._currentframe>=myMovie_mc[loadedmovie.swf]._totalfr
ames) {
loadMovie("newmovie.swf","myMovie_mc");
}
but I keep getting an undefined value for the frame count. Am I missing
something?
kglad
7/31/2007 8:02:58 PM
your code should reference the target movieclip of _level of your loadMovie,
loadMovieNum or loadClip method:



myMovie_mc.loadMovie("newmovie.swf");
preloadI=setInterval(preloadF,100);
function preloadF(){
bl=myMovie_mc.getBytesLoaded();
bt=myMovie_mc.getBytesTotal();
if(bl>10&&bl==bt){
clearInterval(preloadI);
checkPlayI=setInterval(checkPlayF,50);
}
}
function checkPlayF(){
if(myMovie_mc._currentframe==myMovie_mc._totalframes){
// play is complete
clearInterval(checkPlayI);
}
}

p.s. it would be best to have, at least, 2 target movieclips so you could
start loading the next swf while the current is playing.
AddThis Social Bookmark Button