# Alpha with If statements

**URL:** https://forum.kirupa.com/t/alpha-with-if-statements/193134
**Category:** flash
**Created:** [July 4, 2006, 5:09pm UTC](https://forum.kirupa.com/t/alpha-with-if-statements/193134 "2006-07-04T17:09:30Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jbailey](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jbailey/32/2380_2.png) [@jbailey](https://forum.kirupa.com/u/jbailey)
#### Post date: [July 4, 2006, 5:09pm UTC](https://forum.kirupa.com/t/alpha-with-if-statements/193134/1 "2006-07-04T17:09:30Z")

</div>

Right now the pictures fade (alpha) to zero and the goto the next frame. I would like to do a If,Then statement where if the alpha of ballMc is certain number the next image will come forward.

Here is my code for one frame (I know if I do it the way I want then I’ll have to use a single frame for everything).

```auto
import mx.transitions.Tween;
import mx.transitions.easing.*;
var mc = ballMc; // <----change the ballMC to whatever the instance name is of your desired clip
var begin = 0;
var end = 100;

ballMc.onLoad = function() {
     var easeType = mx.transitions.easing.Regular.easeOut;
        var time = 2;
        movieTween = new mx.transitions.Tween(mc, "_alpha", easeType, begin, end, time, true);
}
function wait() { // a function called 'wait'
  var easeType = mx.transitions.easing.Regular.easeOut;
        var time = 2;
     movieTween = new mx.transitions.Tween(mc, "_alpha", easeType, end, begin, time, true);
  clearInterval(myTimer); //stops the function being called again.
  nextFrameplease;
}
myTimer = setInterval(wait, 2100); // calls the function wait after 2 seconds

function nextFramePlease() { // a function called 'wait'
 clearInterval(myTimer2); //stops the function being called again.
 gotoAndPlay(_currentFrame+1);  
}
myTimer2 = setInterval(nextFramePlease, 4200); // calls the function wait after 2 seconds

```
