CLASE MAIN
[as]package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
//
public class Main extends MovieClip {
public var currentFrameClip:MovieClip;
public function Main() {
this.boton1.addEventListener(MouseEvent.CLICK,gotoFrame);
this.boton2.addEventListener(MouseEvent.CLICK,gotoFrame);
this.boton3.addEventListener(MouseEvent.CLICK,gotoFrame);
this.boton4.addEventListener(MouseEvent.CLICK,gotoFrame);
this.boton5.addEventListener(MouseEvent.CLICK,gotoFrame);
this.stop();
}
public function gotoFrame(e:MouseEvent):void {
switch (e.currentTarget) {
case boton1 :
currentFrameClip.gotoFrame(1);
break;
case boton2 :
currentFrameClip.gotoFrame(2);
break;
case boton3 :
currentFrameClip.gotoFrame(3);
break;
case boton4 :
currentFrameClip.gotoFrame(4);
break;
case boton5 :
currentFrameClip.gotoFrame(5);
break;
}
}
}
}[/as]
CLASE FRAMEINOUT
[as]package {
import flash.display.MovieClip;
import flash.events.Event;
//
public class FrameInOut extends MovieClip {
public var goto:uint;
//
public function FrameInOut() {
MovieClip(this.parent).currentFrameClip=this;
frameIntro();
}
public function gotoFrame(frame:uint):void {
if (frame!=MovieClip(this.parent).currentFrame) {
goto=frame;
this.gotoAndStop("on");
this.addEventListener(Event.ENTER_FRAME,avanzaFrame);
}
}
public function frameIntro():void {
this.gotoAndStop("out");
this.addEventListener(Event.ENTER_FRAME,retrocedeFrame);
}
public function retrocedeFrame(e:Event):void {
if (this.currentLabel=="on") {
this.removeEventListener(Event.ENTER_FRAME,retrocedeFrame);
} else {
this.prevFrame();
}
}
public function avanzaFrame(e:Event):void {
if (this.currentLabel=="out") {
this.removeEventListener(Event.ENTER_FRAME,avanzaFrame);
MovieClip(this.parent).gotoAndStop(goto);
} else {
this.nextFrame();
}
}
}
}[/as]
