PDA

View Full Version : need mc's to play sucessively....


lokjah
02-26-2004, 12:28 PM
Id really appreciate it if someone could check out this code in my fla.. basically i want to make a banner that has 7 movie clips that play one after the other... i have a fadein code on each of them with a set fade in time...

on the timeline actions frame 1 i have

_root.img_2mc._visible = false;
stop();

and i have a mc's layer which so far i have 2 movie clips in frame 1, both with instance names img_1mc and img_2mc

on img_1mc instance i have this code:

onClipEvent (load)
{
this._alpha = 0;
fadespeed = 2;
_root.img_1mc.gotoAndPlay(2);
stop();

}


onClipEvent(enterFrame)
{
trace("this._alpha = " + this._alpha);
if (this._alpha + fadespeed < 99)
{
this._alpha += fadespeed;
}
else
{
this._alpha = 99;
}

stop();
_root.img_2mc._visible=true;
_root.img_2mc.gotoAndPlay(1);
}

and on img_2mc instance i have this code:



onClipEvent (load)
{

this._alpha = 0;
fadespeed = 2;
}

onClipEvent(enterFrame)
{
stop();
trace("this._alpha = " + this._alpha);
if (this._alpha + fadespeed < 99)
{
this._alpha += fadespeed;
}
else
{
this._alpha = 99;
}
}


what is happening is that they are both showing up at the same time and playing, the second one doesnt start after the first one is finished.

the movie clips only have 1 frame in them and im only using 1 frame on the timeline... is that wrong?


thanks alot, im just not doing something right..



løk

nthpixel
02-26-2004, 09:33 PM
Try this. On the first frame in you main timeline put


fadeSpeed = 2;
function startFadeIn(movie){
movie.onEnterFrame = function(){
if(movie._alpha + _root.fadeSpeed < 99){
movie._alpha += _root.fadeSpeed;
}
else{
movie._alpha = 99;
}
}
}
startFadeIn(img_1mc);
stop();


This will keep your fade in central so if you want to change the speed or anything else, just do it here.

Then add the following code to each mc


onClipEvent (load){
_alpha = 0;
}

onClipEvent(enterFrame){
if(_alpha > 98){
_root.startFadeIn(_root.img_2mc);
}
}


That should do it.