all groups > flash actionscript > october 2006 >
You're in the

flash actionscript

group:

Button problem


Button problem Mikeb88_69
10/17/2006 11:08:31 PM
flash actionscript:
I have 2 movie clips (photo1_m, and photo2_m).

Inside of these movie clips are 1 button (photo1_b, photo2_b)

What I want is, when you roll over the button, the entire screen fades to back
as a picture fades in. When you roll out, they both fade out (using a rewind
function).

The code I have for BOTH movie clips are:

(in first frame)

stop();
Mouse.show();

this.onEnterFrame=function();{
if (rewind==true){
prevframe();
}

EXPLANATION: I have a function, if rewind is true, go to the previous frame
until rewind equals false

(applied to buttons)

on (rollOver){
rewind=false;
play();
}

on (rollOut){
rewind=true;
}

EXPLANATION: When they roll over the button, play the movie clip (which
contains fade in animation), when they roll out, execute the rewind function

(in last frame)

stop();
Mouse.hide();

EXPLANATION: Once the fade in is complete, stop on the last frame, hide the
mouse, and wait for roll over to rewind

[b]PROBLEM[/b]
The first movie clip (photo1_m) works absolutely perfect and does exactly what
I want it to do. The second button doesnt work at all. It has the exact layout
and the exact code?

THANKS :D
Re: Button problem Mikeb88_69
10/18/2006 12:49:37 PM
Re: Button problem Mikeb88_69
10/20/2006 12:11:01 AM
Re: Button problem TimSymons
10/20/2006 12:44:39 AM
What version of Flash do you have?

I put your code into a movie and it worked. I copied it directly from the code
above. The only thing that came back was during compiling (in Flash 8) was that
the onEnterFrame defintion was missing a "}" and had an extra ";". It should be:

this.onEnterFrame=function() {
if (rewind==true){
prevframe();
}
};

Tim


Re: Button problem Mikeb88_69
10/20/2006 12:46:41 AM
I am using Flash 8. That was a typo in the forums, my actual code has that. Is
there a problem when you have two functions in different movie clips trying to
work at the same time or something? Because the very first movieclip/button
work perfectly....the second one doesnt work at all.
Re: Button problem TimSymons
10/20/2006 12:58:42 AM
Mike,

It worked as I expected and each movieclip was functioning separately from the
other. The only thing that I had a little trouble with was that when the mouse
was hidden, it was difficult to tell when it was over the other button until it
just suddenly appeared.

Tim
Re: Button problem Mikeb88_69
10/20/2006 1:31:16 AM
I just started from scratch and really payed attention to the code and
everything worked perfectly. Thanks :D

Now I have a new problem though. Since these buttons are on the same layer,
when one button is rolled over, it needs to move in from of the other two. I
have used a normal swapdepths(1000); in each movie clip, but that doesnt work.
How do I make the movie clip come to the front of the other two at all times?
AddThis Social Bookmark Button