PDA

View Full Version : simple help Onrollover PLs help me



Terces
August 12th, 2003, 10:34 AM
Hello I am new here, I am trying out actionscript and i have some problems in creating movie clip buttons.

So can someone pls do a sample for me to c and explain juz tat small portion of codes to me.

In this file i attached I wanted the effect that when the mouse is over the button crab, the crab will move left/right and back to the original position. I tried several times. However all I got was a crab that moved according to the motion tween before i even had my mouse over it. Help please T_T I did follow the so called "help" in Flash MX...but sigh...

Thank in advance

kO2n
August 12th, 2003, 10:43 AM
Hi, there are a few ways of doing this. The first way i learnt was to create a button with my graphic, in this instance, a crab. Then i would create a new movie clip, and drag the crab button from the library into the movie clip. So that i have a button nested inside the movie clip. Now, in the movie clip i would have a tween of the crab moving and use a stop(); action in the first frame to stop the animation from playing. Then to the button inside the movieclip i would add something like the following:



on(rollOver) {
this.play();
}


That will make the movie clip play the animation of the crab moving.

Thats one way. Another would be to attach button event handlers to the movie clip itself. This is possible because a the movieclip object can use those handlers.
This is a little harder. So i'll make the two examples in the fla so you can see for your self.

Be right back,
Regards,
Viru.

kO2n
August 12th, 2003, 10:57 AM
Here you are.
Crab 1 has the button event handlers attached to it.
And
Crab 2 has a button nested inside the mc.

Regards,
Viru.

Terces
August 12th, 2003, 11:47 AM
kO2n Thx for your help really!!! I am now studying what you have told me and trying it out. I am an actionscript newbie thx thx~ I will post if i have anymore qns!