# Alpha fade in using actionscript

**URL:** https://forum.kirupa.com/t/alpha-fade-in-using-actionscript/60830
**Category:** Uncategorized
**Created:** [August 12, 2004, 10:01pm UTC](https://forum.kirupa.com/t/alpha-fade-in-using-actionscript/60830 "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/60830/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: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 12, 2004, 10:30pm UTC](https://forum.kirupa.com/t/alpha-fade-in-using-actionscript/60830/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: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 12, 2004, 10:33pm UTC](https://forum.kirupa.com/t/alpha-fade-in-using-actionscript/60830/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: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 12, 2004, 10:57pm UTC](https://forum.kirupa.com/t/alpha-fade-in-using-actionscript/60830/4 "2004-08-12T22:57:58Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 12, 2004, 11:05pm UTC](https://forum.kirupa.com/t/alpha-fade-in-using-actionscript/60830/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: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 12, 2004, 11:06pm UTC](https://forum.kirupa.com/t/alpha-fade-in-using-actionscript/60830/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: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 12, 2004, 11:21pm UTC](https://forum.kirupa.com/t/alpha-fade-in-using-actionscript/60830/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:

😛
