Visible, true with fade?

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
.swf file

What do you mean exactly, fading or easing ?

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…

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

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

Here are some prototypes you can use:


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:


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

*Woops, forgot the = function :stuck_out_tongue:

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 :wink:

Here’s your modified fla just in case :wink:

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

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

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:

Here you go :slight_smile:

*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).

here y’go :slight_smile:

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…

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 :wink:

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

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

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(-:

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


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);
        }
};

oops, yep, that makes more sense(-:

scotty

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. :stuck_out_tongue: