# When button pushed, Alpha 0 --\> 100, when released it has to fade back till zero

**URL:** https://forum.kirupa.com/t/when-button-pushed-alpha-0-100-when-released-it-has-to-fade-back-till-zero/12307
**Category:** Uncategorized
**Created:** [January 29, 2003, 3:22pm UTC](https://forum.kirupa.com/t/when-button-pushed-alpha-0-100-when-released-it-has-to-fade-back-till-zero/12307 "2003-01-29T15:22:43Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![SDSNATCHER](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@SDSNATCHER](https://forum.kirupa.com/u/SDSNATCHER)
#### Post date: [January 29, 2003, 3:22pm UTC](https://forum.kirupa.com/t/when-button-pushed-alpha-0-100-when-released-it-has-to-fade-back-till-zero/12307/1 "2003-01-29T15:22:43Z")

</div>

Ï’m making a flash movie, and got a little problem.  
my flash ain’t really good, so its kind of hard to find the right solution.

[Beta Version Of Digital Portfolio](http://www.fitnesscentrumburgum.nl/Portfoliobeta2.html)

i made a button, of my own face :-s ( please don’t laugh… 😊 )

when you move the mouse over it will fade in,  
but when I release it, it falls back till 0 procent.

so my problem is, i need the button to fade back, to zero procent.  
in a couple of sec… ( just as fast as it fades in.)

i heard there is a technique that you can make the movie play back, ? “backward” .

hope you guys understand what I’m meaning, otherways i will try to explain again.

thnx 🙂 allready

---

<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: [January 29, 2003, 3:29pm UTC](https://forum.kirupa.com/t/when-button-pushed-alpha-0-100-when-released-it-has-to-fade-back-till-zero/12307/2 "2003-01-29T15:29:41Z")

</div>

just reverse the script that you have it fading in.

here is what the fade in and out script should look like:  
this should be on the button:

```php

on(rollOver){
flag = true;
}

```

This should be on the movieclip:

```php

on(enterFrame){
     if(flag){
          if(_alpha < 100){
                _alpha += 10
          }
     }else{
          if(_alpha > 0){
                _alpha -= 10
          }
      }
}

```

---

<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: [January 29, 2003, 3:30pm UTC](https://forum.kirupa.com/t/when-button-pushed-alpha-0-100-when-released-it-has-to-fade-back-till-zero/12307/3 "2003-01-29T15:30:31Z")

</div>

if that doesn’t work, try to put \_root.flag instead of just flag and if that doens’t work try \_parent.flag

its hard to really tell if I don’t know the set up of your movie.

---

<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: [January 29, 2003, 3:36pm UTC](https://forum.kirupa.com/t/when-button-pushed-alpha-0-100-when-released-it-has-to-fade-back-till-zero/12307/4 "2003-01-29T15:36:09Z")

</div>

aaaah, its kind of simpel.

if you have checked the site,

if you go over my face ( that picture is a button,)

on the “over” status, i put a movie clip. that has my  
face fade in to 100% alpha.

thats all 🙂

wait i saw something that kind of looks like it:

on (rollOver) {  
tellTarget ("/controller") {  
gotoAndPlay(“forward”);  
}  
}  
on (rollOut) {  
tellTarget ("/controller") {  
gotoAndPlay(“backward”);  
}  
}

this is from a flash movie, when you go over the button, a flash movie starts playing. (then the picture becomes bigger… )

but i don’t understand how i’m gonna give these commands to my main button,… man programming is so hard :hangover:

---

<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: [January 29, 2003, 3:42pm UTC](https://forum.kirupa.com/t/when-button-pushed-alpha-0-100-when-released-it-has-to-fade-back-till-zero/12307/5 "2003-01-29T15:42:16Z")

</div>

ok, because you have your MC (movieclip) in the OVER state then you can’t do what you want to do. take the MC out of the button and just place the button on top of the MC on the main stage.

---

<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: [January 29, 2003, 3:43pm UTC](https://forum.kirupa.com/t/when-button-pushed-alpha-0-100-when-released-it-has-to-fade-back-till-zero/12307/6 "2003-01-29T15:43:30Z")

</div>

but, how did the guy get the controler in there?,  
can you add controlers or something?  
or do they come from somewhere else?

or do you maby know a tutorial that cna tell me more about them.

thnx in advance

---

<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: [January 29, 2003, 3:45pm UTC](https://forum.kirupa.com/t/when-button-pushed-alpha-0-100-when-released-it-has-to-fade-back-till-zero/12307/7 "2003-01-29T15:45:00Z")

</div>

dont use that tutorial, or whereever you got that code from. Its old outdated syntax. That is from Flash 4. I’ll make you a file… hold on a few seconds.

---

<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: [January 29, 2003, 3:49pm UTC](https://forum.kirupa.com/t/when-button-pushed-alpha-0-100-when-released-it-has-to-fade-back-till-zero/12307/8 "2003-01-29T15:49:25Z")

</div>

Here is the file. Make the button invisible by placing everying in the “HIT” frame only and then just copy what I did here.

---

<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: [January 29, 2003, 3:54pm UTC](https://forum.kirupa.com/t/when-button-pushed-alpha-0-100-when-released-it-has-to-fade-back-till-zero/12307/9 "2003-01-29T15:54:07Z")

</div>

■■■■ you’re good 🙂

one day i’ll be just as smart as you 🙂  
oke i’m going to try it now.

(another maby dumb question)

is it possible to have the name of a day posted in flash,  
(so then i mean, like getSeconds, getMonth \<— you will get a number, but can it also be the name of a month? like january?)

or do you have to programm it like:

if 1 then january.  
if 2 the february.

I know i’m a noob :)… but i’m kind of intressted if its possible.

but much thnx, for your help allready 🙂

---

<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: [January 29, 2003, 4:13pm UTC](https://forum.kirupa.com/t/when-button-pushed-alpha-0-100-when-released-it-has-to-fade-back-till-zero/12307/10 "2003-01-29T16:13:10Z")

</div>

Here is a tutorial I wrote a while ago:

[http://www.kirupa.com/developer/actionscript/digital\_clock.asp](http://www.kirupa.com/developer/actionscript/digital_clock.asp)

---

<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: [January 29, 2003, 4:17pm UTC](https://forum.kirupa.com/t/when-button-pushed-alpha-0-100-when-released-it-has-to-fade-back-till-zero/12307/11 "2003-01-29T16:17:58Z")

</div>

great thnx alot 🙂

(may i ask what kind of study you have done, or did you all learn it yourself?)

:geek: C:-)

---

<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: [January 29, 2003, 4:46pm UTC](https://forum.kirupa.com/t/when-button-pushed-alpha-0-100-when-released-it-has-to-fade-back-till-zero/12307/12 "2003-01-29T16:46:27Z")

</div>

[Voila Update With the good Fading](http://www.fitnesscentrumburgum.nl/Portfoliobeta3.html)

thnx alot, it works (alto i still not really know how you did it,)  
i have swapt the movie you used with mine,  
this way i got it to work.

if you ever able to write a short tutorial,  
how you exactly did it.

i think alot of people would like it 🙂 ( I would _giggle giggle_ 😉 )

(also if you make a SWF file of the thing you made, and put it in a other movie it won’t work, you have to put in the 2 layers u used.) can you explain why?

(… sorry for taking alot of your time, so no prob if you don’t want to.)

---

<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: [January 29, 2003, 5:10pm UTC](https://forum.kirupa.com/t/when-button-pushed-alpha-0-100-when-released-it-has-to-fade-back-till-zero/12307/13 "2003-01-29T17:10:25Z")

</div>

oh wait, now i get it 🙂 dumbie dumb dumb.

ooooh ■■■■, how can someone become so stupid!!

doooh… its so simple,

(not the programming stuff, but i didn’t understand where you did all the functions)

foolish me :crazy:
