You need a monitor to know when one movie clip has completed play. A simple
monitor could be adding onEnterFrame handler to the container_mc when
MovieClipLoader onComplete or onInit is fired. In that handler a test to see
when the loaded clip's _currentframe == the loaded clip"s _totaframes.
Ex:
this.createEmptyMovieClip("container_mc", this.getNextHighestDepth());
container_mc._x = 0;
container_mc._y = 0;
var swfNumber:Number = 0;
var swfNumberMax:Number = 25;
var swfNamePrefix = "MovieClipLoaderDetectEndOfPlay_Movie";
var mclListener:Object = new Object();
mclListener.onLoadStart = function(target_mc:MovieClip)
{
target_mc.startTimer = getTimer();
};
mclListener.onLoadComplete = function(target_mc:MovieClip)
{
target_mc.completeTimer = getTimer();
};
mclListener.onLoadInit = function(target_mc:MovieClip)
{
var timerMS:Number = target_mc.completeTimer - target_mc.startTimer;
target_mc.play();
target_mc.onEnterFrame = function()
{
trace(this._currentframe)
if (this._currentframe == this._totalframes)
{
trace("Load Next Swf")
loadNextSwf()
}
};
};
var container_mcl:MovieClipLoader = new MovieClipLoader();
container_mcl.addListener(mclListener);
function loadNextSwf()
{
swfNumber++;
if (swfNumber <= swfNumberMax)
{
var swfSuffix = ((swfNumber<10)?"0" :"") + swfNumber;
container_mcl.loadClip(swfNamePrefix + swfSuffix + ".swf", container_mc);
}
}
loadNextSwf()
--
Lon Hosford
www.lonhosford.com May many happy bits flow your way!
[quoted text, click to view] "dragonlilly" <webforumsuser@macromedia.com> wrote in message
news:e20o1d$h5n$1@forums.macromedia.com...
I have a question and hope that someone may be able to help; this might be
a
piece of cake for you...
I have a container .fla movie and would like to load consecutive external
..swf
files. Right now I have a play button triggering the loading of the next
movie, but what I would REALLY like is a smooth transition from .swf to .swf
using a listener so that the next .swf will load once the previous one has
finished. I have a counter which determines the next .swf in order.
So far, my code is this:
Counter:
stop();
//SETUP OUR COUNTER
var mcCounter:Number = 0;
//THIS BLOCK IS ONLY TO HANDLE THE LOADER AND THE FIRST MOVIE, movie0.swf
var myMCL:MovieClipLoader = new MovieClipLoader();
var loadListener:Object = new Object();
myMCL.addListener(loadListener);
myMCL.loadClip("movie" + mcCounter + ".swf", 6);
loadListener.onLoadComplete = function():Void {
_level0.play();
}
//-------------------------<CLIP LOADERS>------------------------------\\
function loadNextClip():Void {
if(mcCounter < 6) {
mcCounter++;
var nextMCL:MovieClipLoader = new MovieClipLoader();
nextMCL.addListener(this);
nextMCL.loadClip("movie" + mcCounter + ".swf",6);
}
}
//LOADS PREVIOUS CLIP , WON"T GO PAST ZERO
function loadPrevClip():Void {
if(mcCounter > 0) {
mcCounter--;
var prevMCL:MovieClipLoader = new MovieClipLoader();
prevMCL.addListener(this);
prevMCL.loadClip("movie" + mcCounter + ".swf",6);
}
}
//-------------------------</CLIP LOADERS>------------------------------\\
Any suggestions? I appreciate ANY help you can offer. I have been
unsuccessfully looking for hours online, and can't find any examples,
although
it doesn't seem as if it should be the hardest thing in the world.
Thanks!
:confused;