0如何实现控制影片动画播放速度?
AS3.0如何实现控制影片动画播放速度?
步骤一、新建一个“背景”图层,并于其中设计场景动画的基本内容; 步骤二、建立“摩天轮”图层,并于基中加入摩天轮影片剪辑“wheel_mc”;步骤三、新建“控制钮”图层,先加入旋钮控制区的影片剪辑“jog_mc”,接着加入旋钮“drag_btn”按钮与用来显示速度的动态文本框“fsp_txt”; 步骤四、新增图层“文稿”,选第1帧,按F9打开动作面板,输入Action Script代码如下:wheel_mc。
stop();var Rot=0;var actMode;var playStep=0;var Pn=1;drag_btn。addEventListener(MouseEvent。MOUSE_DOWN,chgYes);function chgYes(me:MouseEvent){actMode=yes;}drag_btn。
addEventListener(MouseEvent。MOUSE_UP,chgNo);function chgNo(me:MouseEvent){actMode=no;}jog_mc。addEventListener(MouseEvent。
MOUSE_MOVE,chkRot);function chkRot(me:MouseEvent){if(actMode==yes){var mX=jog_mc。mouseX;var mY=-(jog_mc。mouseY);Rot=Math。
atan2(mX,mY)/(Math。PI/180);drag_btn。rotation=Rot;}}stage。addEventListener(Event。ENTER_FRAME,cirPlay);function cirPlay(me:Event){ Pn=1;if (Rot0){Pn=-1;}playStep=Math。
floor(Math。abs(Rot)/30);if(playStep5){playStep=5;}fps_txt。text=String(playStep * 12 * Pn);for (var i=1;i=playStep;i++){if(Pn0){wheel_mc。
nextFrame();if (wheel_mc。currentFrame==wheel_mc。totalFrames){wheel_mc。gotoAndPlay(1);}}else{wheel_mc。prevFrame();if (wheel_mc。
currentFrame==1){wheel_mc。gotoAndPlay(wheel_mc。totalFrames);}}}}。
答:先给你做一个,是不是这样的效果.是这个效果的话,就给你源文件,写教程很费时.详情>>
答:详情>>