N
N
nikabekish2018-12-20 13:05:13
ActionScript
nikabekish, 2018-12-20 13:05:13

How to make the animation repeat after some time?

My movie clip has a fade in animation
I used the code snippet provided by Adobe Animate

var movieClip_4_FadeInCbk = fl_FadeSymbolIn_4.bind(this);
this.addEventListener('tick', movieClip_4_FadeInCbk);
this.movieClip_4.alpha = 0;

function fl_FadeSymbolIn_4()
{
  this.movieClip_4.alpha += 0.06;
  if(this.movieClip_4.alpha >= 1)
  {
    this.removeEventListener('tick', movieClip_4_FadeInCbk);
  }
}

After the movie clip appears, the animation no longer repeats. How can I make the animation repeat after 5 seconds, for example?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Grishin, 2018-12-20
@nikabekish

Use flash.utils.setTimeout() to run the code after the specified time. Use the reinitialize "tick" listener to start the animation (changing the alpha, to be exact), and set the alpha to 0 to start the spawn again.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question