Pause between actionscript lines

Here is what I want to do in the code. Animate your car’s MC for x seconds. After the car is done, move the dog’s MC for y seconds. Etc...

With this code, all animations are performed simultaneously.

car.slideTo (200,100,1);
dog.slideTo (200,100,5);
blimp.slideTo (200,100,2);

...

Is it possible to write a pause function to set between these lines? I tried using getTimeout, but I want to avoid the need to define each animation as a separate function.

+3
source share
5 answers

, . ActionScript - , . , , ( , ) ​​ .

setTimeout().

+4

setInterval (my_func, 1000), my_func 1 .

+3

, SetInterval().

, :

var Timer = setInterval(delay, 500); //calls the function delay after 500 milliseconds

function delay () {
    trace("delayed!");
    clearInterval(Timer); //stops the function from being called again
}
+2

TweenMax http://blog.greensock.com/tweenmaxas3/

, , .

, .

import gs.TweenMax;
// move the movieclip to (500,200) in 2 seconds:
var myTween:TweenMax = new TweenMax(mc, 2, {x:500, y:200});

,

myTween.pause();

, ,

,

import gs.*;

var tween1:TweenMax = new TweenMax(mc1, 1, {x:300,y:400});
var tween2:TweenMax = new TweenMax(mc2, 1, {x:200,y:400});
var tween3:TweenMax = new TweenMax(mc3, 1, {x:100,y:400});

var myGroup:TweenGroup = new TweenGroup([tween1, tween2, tween3]);
myGroup.align = TweenGroup.ALIGN_SEQUENCE;

, TweenMax Tweensy tweening, AS3, TweenMax , -, tween http://blog.greensock.com/tweening-speed-test/

+1

, ActionScript. Flash , : , , . , , .

, - , Flash , . , , Flash , .

This may seem like pain, but getTimeoutthat is what you should use. Or you can also use the twin library, which includes a delay function to start the animation, for example, presented in the answer "Unrealism". Underneath it is one and the same.

0
source

Source: https://habr.com/ru/post/1710182/


All Articles