我有一个实例名称太空船的动画片段。点击这个动画片段,我想改变过渡的速度。这是我的代码:
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
}
那就是我希望宇宙飞船能够加速鼠标点击......
答案 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;
}