View Full Version : Multiple goto
beowulfens
05-05-2008, 03:35 PM
Is it in any way possible to run multiple goto on a single function?
function retrograder(){
_level0.C_MenuBase.boiteetir.gotoAndPlay("CloseLvl2");
_level0.C_MenuBase.boiteetir.TextNiv2.gotoAndStop("MenuMotion");
_level0.C_MenuBase.boiteetir.gotoAndPlay("OpenLvl2");
}
Well, they would certainly both fire, but since it would be (virtually) instantaneous you would only see the second frame label as the end result.
Like, if you ran this you would see the frames each returned to the output window, but your eye would only see frame 3:
function frameJump() {
this.gotoAndPlay(2);
trace(this._currentframe);
this.gotoAndPlay(3);
trace(this._currentframe);
}
frameJump();
//Returns:
//2
//3
You probably want some kind of interval or timer if you are looking for one to happen after the other. Or you could always just place this on the timeline of "C_MenuBase.boiteetir" at the point where you want it to jump to this frame, and have the function just send it to "CloseLvl2":
this.gotoAndPlay("OpenLvl2");
beowulfens
05-06-2008, 10:03 PM
is there any way of having the 3rd goto to wait for the first and second to finish?
Well, like I said above, you could simply place your next goto on the timeline you want to control at the point you want it to fire.
Alternatively you can create a repeating function (onEnter or an interval) that checks a timeline's currentframe and fire your goto when it reaches the correct frame.
beowulfens
05-07-2008, 01:13 AM
Thats what i would need a repeating function but as to now ive failed at having a loop that work with _currentframe
beowulfens
05-07-2008, 03:22 PM
I finally made it with an onClipEvent(enterframe) and a switch inside to determine what to do after. Its still in construction but it already works
onClipEvent(load){
stop();
}
onClipEvent(enterFrame){
trace(_global.destination);
trace(Number(this._currentframe));
switch(Number(_global.destination)){
case 1 :
if(Number(this._currentframe)==1){
this.stop();
}
if(Boolean(iindex)==true){
iindex=false;
_root.C_Menu.gotoAndPlay("ToIndex");
}
break;
case 5 :
if(Number(this._currentframe)==5){
this.stop();
}
break;
case 10 :
if(Number(this._currentframe)==10){
this.stop();
}
break;
case 15 :
if(Number(this._currentframe)==15){
this.stop();
}
break;
case 18 :
if(Number(this._currentframe)==18){
this.stop();
}
break;
case 21 :
if(Number(this._currentframe)==21){
this.stop();
}
break;
case 24 :
if(Number(this._currentframe)==1){
this.stop();
}
break;
default :
break;
}
}
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.