# While loops and alpha

**URL:** <https://forum.kirupa.com/t/while-loops-and-alpha/313882>\
**Category:** Uncategorized\
**Created:** [September 13, 2010, 3:03am UTC](https://forum.kirupa.com/t/while-loops-and-alpha/313882 "2010-09-13T03:03:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![averageUser](https://avatars.discourse-cdn.com/v4/letter/a/0ea827/32.png) [@averageUser](https://forum.kirupa.com/u/averageUser)\
**Post date:** [September 13, 2010, 3:03am UTC](https://forum.kirupa.com/t/while-loops-and-alpha/313882/1 "2010-09-13T03:03:24Z")

</div>

The trace on this loop shows the values are changing, but the actual event is instantaneous and without alpha.

```php

function txtFade(mc:Object,i:Number):Number{
    var boolDone:Boolean = false;
    var bool:Boolean = true;
    while(boolDone == false){
        if(bool == true){
            if(mc.alpha>0){
                mc.alpha -= 0.01;
trace(mc.alpha);
            }else{
                bool = false;
                i++;
            }
        }else{
            if(mc.alpha<1){
                mc.alpha += 0.01;
            }else{
                boolDone = true;
            }
        }
    }
    return i;
}

```

Any ideas?

Thanks
