# Alpha fade in using actionscript

**URL:** <https://forum.kirupa.com/t/alpha-fade-in-using-actionscript/119263>\
**Category:** Uncategorized\
**Created:** [August 12, 2004, 10:01pm UTC](https://forum.kirupa.com/t/alpha-fade-in-using-actionscript/119263 "2004-08-12T22:01:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigbadmilkman](https://avatars.discourse-cdn.com/v4/letter/b/9fc348/32.png) [@bigbadmilkman](https://forum.kirupa.com/u/bigbadmilkman)\
**Post date:** [August 12, 2004, 10:01pm UTC](https://forum.kirupa.com/t/alpha-fade-in-using-actionscript/119263/1 "2004-08-12T22:01:00Z")

</div>

Hi I am trying to fade in an image using actionscript,

this is the code i have,

speed = 10;  
image.onEnterFrame = function(){  
this.\_alpha\>=100 ? this.\_alpha-=speed : delete this.onEnterFrame;  
}

I’ve set the image on stage to alpha 0, i run this movie but nothing seems to happen, i’ve given the movie clip name an instance name of image.

can someone help?

---

<div class="post-metadata">

**Author:** ![iloveitaly](https://avatars.discourse-cdn.com/v4/letter/i/7ea924/32.png) [@iloveitaly](https://forum.kirupa.com/u/iloveitaly)\
**Post date:** [August 12, 2004, 10:30pm UTC](https://forum.kirupa.com/t/alpha-fade-in-using-actionscript/119263/2 "2004-08-12T22:30:08Z")

</div>

try this:

```auto

var speed = 10;
image.onEnterFrame = function() {
(this._alpha<=100) ? this._alpha+=speed : delete this.onEnterFrame;
}

```

---

<div class="post-metadata">

**Author:** ![Jeff\_Wheeler](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Jeff\_Wheeler](https://forum.kirupa.com/u/Jeff_Wheeler)\
**Post date:** [August 12, 2004, 10:33pm UTC](https://forum.kirupa.com/t/alpha-fade-in-using-actionscript/119263/3 "2004-08-12T22:33:04Z")

</div>

hey… I’ve seen that so often, but never known the name of that conditional statement… what’s it called?

---

<div class="post-metadata">

**Author:** ![March4Revenge](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@March4Revenge](https://forum.kirupa.com/u/March4Revenge)\
**Post date:** [August 12, 2004, 10:57pm UTC](https://forum.kirupa.com/t/alpha-fade-in-using-actionscript/119263/4 "2004-08-12T22:57:58Z")

</div>

Mee tooo! I need to know this one as well!

---

<div class="post-metadata">

**Author:** ![iloveitaly](https://avatars.discourse-cdn.com/v4/letter/i/7ea924/32.png) [@iloveitaly](https://forum.kirupa.com/u/iloveitaly)\
**Post date:** [August 12, 2004, 11:05pm UTC](https://forum.kirupa.com/t/alpha-fade-in-using-actionscript/119263/5 "2004-08-12T23:05:36Z")

</div>

well, go right to the [source](http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary021.html).  
anyways its the same as going:

```auto

var speed = 10;
image.onEnterFrame = function() {
if(this._alpha<=100) {
this._alpha+=speed 
} else { 
delete this.onEnterFrame;
}
}

```

---

<div class="post-metadata">

**Author:** ![lostinbeta](https://avatars.discourse-cdn.com/v4/letter/l/db5fbb/32.png) [@lostinbeta](https://forum.kirupa.com/u/lostinbeta)\
**Post date:** [August 12, 2004, 11:06pm UTC](https://forum.kirupa.com/t/alpha-fade-in-using-actionscript/119263/6 "2004-08-12T23:06:39Z")

</div>

It is called a tertiary operator…

[http://www.kirupa.com/developer/actionscript/tricks/tertiary.htm](http://www.kirupa.com/developer/actionscript/tricks/tertiary.htm)

---

<div class="post-metadata">

**Author:** ![Jeff\_Wheeler](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Jeff\_Wheeler](https://forum.kirupa.com/u/Jeff_Wheeler)\
**Post date:** [August 12, 2004, 11:21pm UTC](https://forum.kirupa.com/t/alpha-fade-in-using-actionscript/119263/7 "2004-08-12T23:21:50Z")

</div>

oh thanks… I never read to the bottom of that page the last time I saw it :lol:

😛
