Flash/Flex学习笔记(29):MovieClip帧/时间轴的控制

在开发过程中,经常会遇到要从一个界面跳到另一个界面的情况,比如:软件中的窗口跳转,web开发中的页面跳转...但在Flash的世界里:只有帧,没有窗口与页面,所以控制时间轴/帧之间的跳转,就成为这一需求最常见的解决办法

view source

print?

01
btn1.addEventListener(MouseEvent.MOUSE_DOWN,function(){md.gotoAndPlay(1);});

02
btn2.addEventListener(MouseEvent.MOUSE_DOWN,function(){md.gotoAndStop(2);});

03
btn3.addEventListener(MouseEvent.MOUSE_DOWN,function(){md.gotoAndPlay(3);});

04
btnPrevious.addEventListener(MouseEvent.MOUSE_DOWN,function(){md.prevFrame();});

05
btnNext.addEventListener(MouseEvent.MOUSE_DOWN,function(){md.nextFrame();});

06

07
md.stop();

08

09
addEventListener(Event.ENTER_FRAME,EnterFrameHandler);

10

11
function EnterFrameHandler(e:Event):void{

12
txtMsg.text = "当前帧/总帧数:" + md.currentFrame + " / " + md.totalFrames;

13
}

源文件: http://cid-2959920b8267aaca.skydrive.live.com/self.aspx/Flash/FrameControl.fla

转载于:https://www.cnblogs.com/happysky97/archive/2010/11/22/1884555.html

你可能感兴趣的:(Flash/Flex学习笔记(29):MovieClip帧/时间轴的控制)