# Visible, true with fade?

**URL:** <https://forum.kirupa.com/t/visible-true-with-fade/34700>\
**Category:** flash\
**Created:** [November 5, 2003, 11:24am UTC](https://forum.kirupa.com/t/visible-true-with-fade/34700 "2003-11-05T11:24:34Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Voursez](https://avatars.discourse-cdn.com/v4/letter/v/b5ac83/32.png) [@Voursez](https://forum.kirupa.com/u/Voursez)\
**Post date:** [November 5, 2003, 11:24am UTC](https://forum.kirupa.com/t/visible-true-with-fade/34700/1 "2003-11-05T11:24:34Z")

</div>

Hi all

I have a little problem with a flash movie. I want to create a sort of dropdown menu, and have used, woth on release visible true, and stuff. It works fine now, but then i found out that i wanted it to fade up, instead of just showing up suddenly. Is there an AS soloution to this? When i press the gallery button, the submenu fades up, and when i press another button, the previous will fade down, and a new submenu will fade up…

[.fla file](http://voursez.net/filer/Menu.fla)  
[.swf file](http://voursez.net/filer/Menu.swf)

---

<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, 11:30am UTC](https://forum.kirupa.com/t/visible-true-with-fade/34700/2 "2003-11-05T11:30:12Z")

</div>

What do you mean exactly, fading or easing ?

---

<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, 11:39am UTC](https://forum.kirupa.com/t/visible-true-with-fade/34700/3 "2003-11-05T11:39:24Z")

</div>

Well, i mean that the submenu should turn from Alpha 0% to Alpha 100% in about 5 frames, when i press the gallery button…So my question was, if i could use AS, to do that, or i need to animate it…

Oh, and the .swf is a direct link…

---

<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, 11:57am UTC](https://forum.kirupa.com/t/visible-true-with-fade/34700/4 "2003-11-05T11:57:49Z")

</div>

Oh ok. Just wasn’t sure. That can be perfectly done. Just a sec.

---

<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, 12:04pm UTC](https://forum.kirupa.com/t/visible-true-with-fade/34700/5 "2003-11-05T12:04:21Z")

</div>

Thanks buddy, i’ll be sitting on needles… :bounce:

---

<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, 12:15pm UTC](https://forum.kirupa.com/t/visible-true-with-fade/34700/6 "2003-11-05T12:15:27Z")

</div>

Here are some prototypes you can use:

```auto

MovieClip.prototype.fadeIn = function(to,speed){
this.onEnterFrame = function(){
this._alpha < to ? this._alpha +=speed : delete this.onEnterFrame
}
}
MovieClip.prototype.fadeOut = function(to,speed){
this.onEnterFrame = function(){
this._alpha > to ? this._alpha -= speed : delete this.onEnterFrame
}
}
// Usage:
yourmovieclip.fadeOut(0,5)

```

Or like this:

```auto

on(rollOver){
certainmovieclip.fadeIn(100,5);
}

```

\*Woops, forgot the = function 😛

---

<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, 12:22pm UTC](https://forum.kirupa.com/t/visible-true-with-fade/34700/7 "2003-11-05T12:22:16Z")

</div>

Holy crap! Could you think of my as a retard please… :sleep:

I dont understand most of that one…Oh, i understand the last one! Thank you very much 😉

---

<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, 12:31pm UTC](https://forum.kirupa.com/t/visible-true-with-fade/34700/8 "2003-11-05T12:31:39Z")

</div>

Here’s your modified fla just in case 😉

Voets, this MC.prototype thing, is it like defining a function or what is it?

---

<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, 2:51pm UTC](https://forum.kirupa.com/t/visible-true-with-fade/34700/9 "2003-11-05T14:51:25Z")

</div>

okay, thanks for the modified flash, and thanks for all the help. That was really useful 🙂

But i have another problem now. i tried to make the submenu fade out, when i press one of the other buttons, and i think i need to change the code to the opposite numbers when i need it to fade out. But that wouldnt work, so i hoped that you could help me with this one too.

I have updated the links at my first post, in case you feel like do it for me :trout:

---

<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, 3:33pm UTC](https://forum.kirupa.com/t/visible-true-with-fade/34700/10 "2003-11-05T15:33:06Z")

</div>

Here you go 🙂

---

<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, 3:38pm UTC](https://forum.kirupa.com/t/visible-true-with-fade/34700/11 "2003-11-05T15:38:51Z")

</div>

> \*Originally posted by Phat7 \*  
> \*\*Voets, this MC.prototype thing, is it like defining a function or what is it? \*\*

It is a function I’m defining in the prototype object of the MovieClip constructor, which you can see as “Shared Documents” for movieclips. If you place something in a constructors prototype, every instance created through that constructor has access to it.

Since MovieClip is the contructor function of the movieclip class (try trace(MovieClip)), I place that function in it’s prototype object. Therefore, every movieclip has access to that function, which will be a method since it’s assigned to an object (the prototype object).

---

<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, 3:45pm UTC](https://forum.kirupa.com/t/visible-true-with-fade/34700/12 "2003-11-05T15:45:25Z")

</div>

here y’go 🙂

---

<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, 5:39pm UTC](https://forum.kirupa.com/t/visible-true-with-fade/34700/13 "2003-11-05T17:39:18Z")

</div>

Thank you very much again :beam:

I’m glad that you postet to modifies, but i really think that Voetsjoebas is the easyest to understand. But thanks again…

---

<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, 7:10pm UTC](https://forum.kirupa.com/t/visible-true-with-fade/34700/14 "2003-11-05T19:10:36Z")

</div>

I was going to tell you that, I was just in a hurry. The code that I’ve posted is not efficient if you use it this much. And Voets is surely the best 😉

---

<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:59pm UTC](https://forum.kirupa.com/t/visible-true-with-fade/34700/15 "2003-11-08T17:59:38Z")

</div>

Hi guys…

I have a new fade problem now. I found out that the fade/hide effect worked great with buttons, but not so great with bigger stuff. So instead im using the \_root.myclipholder.loadMovie(“something.swf”) script. The question is now, that can this be combined with the fade effect? Like when its loaded, then it needs to go from alpha=0 to alpha=100 in about ten frames?

Thanks

---

<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, 3:23pm UTC](https://forum.kirupa.com/t/visible-true-with-fade/34700/16 "2003-11-09T15:23:51Z")

</div>

Come on guys, you must know this one…I just need a little push is the rigoht direction…

---

<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, 3:50pm UTC](https://forum.kirupa.com/t/visible-true-with-fade/34700/17 "2003-11-09T15:50:06Z")

</div>

not tested, try:  
[AS]\_root.myclipholder.loadMovie(“something.swf”);  
l = \_root.myclipholder.getBytesLoaded();  
t = \_root.myclipholder.getBytesTotal();  
\_root.myclipholder.onEnterFrame = function() {  
if (t\>0 && t == l) {  
this.fadeIn(100, 10);  
//where fadeIn the prototype is Voetsjoeba gave you  
} else {  
trace(l/t);  
}  
};  
[/AS]

scotty(-:

---

<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, 3:59pm UTC](https://forum.kirupa.com/t/visible-true-with-fade/34700/18 "2003-11-09T15:59:56Z")

</div>

Scotty – You have to update the bytes loaded 😉 Like this:

```auto

myclipholder.loadMovie("something.swf");
myclipholder.onEnterFrame = function() {
l = this.getBytesLoaded();
t = this.getBytesTotal();
        if (t>0 && t == l) {
                this.fadeIn(100, 10);
                //where fadeIn the prototype is Voetsjoeba gave you
        } else {
                trace(l/t);
        }
};

```

---

<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:19pm UTC](https://forum.kirupa.com/t/visible-true-with-fade/34700/19 "2003-11-09T16:19:23Z")

</div>

oops, yep, that makes more sense(-:

scotty

---

<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:49pm UTC](https://forum.kirupa.com/t/visible-true-with-fade/34700/20 "2003-11-09T16:49:56Z")

</div>

You should get the bytes total within the [font=courier new]onEnterFrame[/font] handler too. If you store the value immediately after you call the [font=courier new]MovieClip.loadMovie()[/font] method, you might get 0 or -1. 😛

[Next page](https://forum.kirupa.com/t/visible-true-with-fade/34700.md?page=2)
