单击movieclip Flash AS3更改转换持续时间

时间:2013-11-05 07:08:02

标签: actionscript-3 flash-cs5 transition

我有一个实例名称太空船的动画片段。点击这个动画片段,我想改变过渡的速度。这是我的代码:

import fl.transitions.*;
import fl.transitions.easing.*; 

var myspaceship:TransitionManager = new TransitionManager(spaceship);
myspaceship.startTransition({type:Fly, direction:Transition.OUT, duration:18,startPoint:6});
spaceship.addEventListener(MouseEvent.CLICK, speedfast);
function speedfast (evt:MouseEvent):void
{
// reset frame count to 0
//here i want the duration to become say 12 or something
}

那就是我希望宇宙飞船能够加速鼠标点击......

1 个答案:

答案 0 :(得分:0)

更新

var myspaceship:TransitionManager = new TransitionManager(spaceship);
var speed:int = 18;

myspaceship.startTransition(
    {type:Fly, direction:Transition.OUT, duration: speed,startPoint:6}
);

spaceship.addEventListener(MouseEvent.CLICK, speedfast);
function speedfast (evt:MouseEvent):void {
   // reset frame count to 0
   trace("Increase Speed");
   speed -= 6;
   trace("Duration of transition: " + speed);
   //Start transition
   trace("Start transition");
   myspaceship.startTransition(
    {type:Fly, direction:Transition.OUT, duration: speed,startPoint:6}
   );
   //or speed = 12;
   //or better speed = speed / 2;
}