# Fade in/fade out effect

**URL:** <https://forum.kirupa.com/t/fade-in-fade-out-effect/34731>\
**Category:** Uncategorized\
**Created:** [November 5, 2003, 9:01pm UTC](https://forum.kirupa.com/t/fade-in-fade-out-effect/34731 "2003-11-05T21:01:04Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![tom\_s](https://avatars.discourse-cdn.com/v4/letter/t/e9a140/32.png) [@tom\_s](https://forum.kirupa.com/u/tom_s)\
**Post date:** [November 5, 2003, 9:01pm UTC](https://forum.kirupa.com/t/fade-in-fade-out-effect/34731/1 "2003-11-05T21:01:04Z")

</div>

ok guys i need help  
in my movie i have button and when i rollover  
over the button , its start contiunosly fade in/fade out effect until i rollout the mouse its have to stop , now i have the script but its works just when i rollover and rollout the mouse and then again i need to rollover again , i searched for this script in forum but didnt find the code for contiunosly effect…  
here is my script …this script goes in my actionscript layer :

b1.onRollOver = function() {  
\_alpha -= 7;

if(\_alpha\<55)  
\_alpha = 100;  
}

help me please …

---

<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:** [November 5, 2003, 9:59pm UTC](https://forum.kirupa.com/t/fade-in-fade-out-effect/34731/2 "2003-11-05T21:59:11Z")

</div>

try

```auto

b1.onRollOver = function() {
     this._alpha -= 7; 

if(_alpha<55)
     this._alpha = 100;
}

```

---

<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:** [November 5, 2003, 10:23pm UTC](https://forum.kirupa.com/t/fade-in-fade-out-effect/34731/3 "2003-11-05T22:23:28Z")

</div>

lunatic thanks , but its fading out and finally its gone, can this fade out for alpha 55 and fade in agian…

---

<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:** [November 5, 2003, 10:54pm UTC](https://forum.kirupa.com/t/fade-in-fade-out-effect/34731/4 "2003-11-05T22:54:56Z")

</div>

try

```auto

b1.onRollOver = function() {
    if((_alpha <= 100) || (_alpha >= 55)){
       this._alpha -= 7;
        }
   else{
        this._alpha = 100;}
}

```

double check my syntax, I may be missing a () or {} 😉

This may make the clip jump right to \_alpha = 100 once \_alpha goes below 55 (i.e. it won’t fade in, just fade out then suddenly 100). If you want it to fade back in then you should +=7 back up to 100.

---

<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:** [November 6, 2003, 12:05am UTC](https://forum.kirupa.com/t/fade-in-fade-out-effect/34731/5 "2003-11-06T00:05:07Z")

</div>

great…thanks for your time , checked working .,  
posible doing this effect by “tell target” ?

---

<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:** [November 6, 2003, 5:50am UTC](https://forum.kirupa.com/t/fade-in-fade-out-effect/34731/6 "2003-11-06T05:50:40Z")

</div>

your welcome mate 😉

don’t know too much about tellTarget. Read up on it in reference or post a new thread. Or better yet, do a thorough search THEN post a new thread . . .

:hr:

---

<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:** [November 6, 2003, 7:41pm UTC](https://forum.kirupa.com/t/fade-in-fade-out-effect/34731/7 "2003-11-06T19:41:47Z")

</div>

okey…😉

---

<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:** [November 8, 2003, 5:21am UTC](https://forum.kirupa.com/t/fade-in-fade-out-effect/34731/8 "2003-11-08T05:21:03Z")

</div>

[AS]  
b1.onRollOver = function() {  
if(!direction){  
direction = 1;  
}  
if((\_alpha \< 100) || (\_alpha \>= 55)){  
this.\_alpha += direction \* 7;  
}  
else{  
direction = -direction;  
}  
}  
[/AS]

That will make it fade out and then in

Hope it helps,  
Shawn

---

<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:** [November 9, 2003, 11:43am UTC](https://forum.kirupa.com/t/fade-in-fade-out-effect/34731/9 "2003-11-09T11:43:53Z")

</div>

for some reason the code doesnt work , maybe i do some wrong

---

<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:** [November 9, 2003, 4:39pm UTC](https://forum.kirupa.com/t/fade-in-fade-out-effect/34731/10 "2003-11-09T16:39:57Z")

</div>

Eehm … don’t you guys need an onEnterFrame handler somewhere ? Or is it me not understanding the goal ? [size=1]\<- Probably that last option here :P[/size]

---

<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:** [November 9, 2003, 9:10pm UTC](https://forum.kirupa.com/t/fade-in-fade-out-effect/34731/11 "2003-11-09T21:10:07Z")

</div>

work your magic here Voets, I don’t have flash available right now to work this out. And you’re right I would need something that was called repeatedly, either enterframe or interval, oh well, sorry tom’s I don’t mean to drop the ball but I just don’t have the time today, if Voets doesn’t have it figured out by tomorrow I will give you a working solution.

And \*\*\*\* Voets born in '88 that makes you like six years younger than me and about 4 times smarter, I love the younger generation, smart so I don’t have to be. 🙂

---

<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:** [November 9, 2003, 11:14pm UTC](https://forum.kirupa.com/t/fade-in-fade-out-effect/34731/12 "2003-11-09T23:14:24Z")

</div>

Uhh… shouldn’t you just tell it to behave as a movie clip? I didn’t read this too thoroughly but that appears to be the problem…

---

<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:** [November 10, 2003, 8:18am UTC](https://forum.kirupa.com/t/fade-in-fade-out-effect/34731/13 "2003-11-10T08:18:07Z")

</div>

Thanks paradox 🙂

I don’t really get what tom is trying to achieve 😛

---

<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:** [November 10, 2003, 11:31pm UTC](https://forum.kirupa.com/t/fade-in-fade-out-effect/34731/14 "2003-11-10T23:31:01Z")

</div>

the effect i want to achieve is a button fadein and fade out  
when u roll over and stay with cursor…

---

<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:** [November 11, 2003, 10:29am UTC](https://forum.kirupa.com/t/fade-in-fade-out-effect/34731/15 "2003-11-11T10:29:36Z")

</div>

when u roll over and stay with cursor… … you want it to fade out or in ?

---

<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:** [November 11, 2003, 1:19pm UTC](https://forum.kirupa.com/t/fade-in-fade-out-effect/34731/16 "2003-11-11T13:19:41Z")

</div>

actually Voetsjoeba i want it to fade in and fade out same time , like here in example but it posible doing this with AS

[http://www.kirupa.com/developer/flash5/animatedrollover.htm](http://www.kirupa.com/developer/flash5/animatedrollover.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:** [November 11, 2003, 3:27pm UTC](https://forum.kirupa.com/t/fade-in-fade-out-effect/34731/17 "2003-11-11T15:27:08Z")

</div>

That’s not fading in and out, that’s shrinking an growing. It is possible, let me work on an example fla for you.

---

<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:** [November 13, 2003, 1:01pm UTC](https://forum.kirupa.com/t/fade-in-fade-out-effect/34731/18 "2003-11-13T13:01:49Z")

</div>

thanks…Voetsjoeba

---

<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:** [November 13, 2003, 7:56pm UTC](https://forum.kirupa.com/t/fade-in-fade-out-effect/34731/19 "2003-11-13T19:56:02Z")

</div>

Sorry, forgot about this thread 😊

---

<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:** [November 14, 2003, 12:14pm UTC](https://forum.kirupa.com/t/fade-in-fade-out-effect/34731/20 "2003-11-14T12:14:02Z")

</div>

the script works fine , thank you Voetsjoeba 😉

[Next page](https://forum.kirupa.com/t/fade-in-fade-out-effect/34731.md?page=2)
