# \[AS2\] Wait until function completes

**URL:** <https://forum.kirupa.com/t/as2-wait-until-function-completes/311552>\
**Category:** flash\
**Created:** [July 9, 2010, 5:12pm UTC](https://forum.kirupa.com/t/as2-wait-until-function-completes/311552 "2010-07-09T17:12:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anthony\_z](https://avatars.discourse-cdn.com/v4/letter/a/2acd7d/32.png) [@anthony\_z](https://forum.kirupa.com/u/anthony_z)\
**Post date:** [July 9, 2010, 5:12pm UTC](https://forum.kirupa.com/t/as2-wait-until-function-completes/311552/1 "2010-07-09T17:12:13Z")

</div>

Quick newbie question.

I have a rollover Glint effect animation on my logo. (I rollover the logo and a quick shiny masked out Glint effect passes through it from left to right.)  
The problem is, if I rollover the logo several times without waiting for the Glint animation to complete, the animation breaks.

So I what I need is to tell the Glint animation (Glint function) to wait until it completes, before being able to be triggered again. (If I rollover the logo several times, the Glint animation always completes first and only plays again after each completion)

I use TweenLite for animating the Glint effect.

Instance names:  
Logo = logo\_mc  
Glint MovieClip = logo\_glint  
Glint function = glintFunc

Here is the Glint function:

```auto

  //Glint function
  function glintFunc ():Void{
          TweenLite.from(logo_glint, 0.8, {_x:-200, ease:Circ.easeOut});
  }
   
  

```

Here is the Logo Rollover function:

```auto

  //Logo rollover
  logo_mc.onRollOver = function():Void{
      glintFunc();
  }
   
  

```

Any idea?  
Thanks for your time!
