Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Advanced Buttons

Status
Not open for further replies.
Dec 24, 2001
857
GB
I found this site where they tell you how to do 'Tell Target Buttons'.

Heres the site :
Anyway, about a quarter of the way down the page they have a button where you move your mouse over it and it expands then goes small again.

I would like to be able to use this effect but have the button stop when its fully expanded, and then go back to being small when the mouse is taken off it.

I downloaded the fla and played about with it, but as you can probably tell, I couldn't figure out how to do what I wanted.

Can anyone explain to me what extra script I need to put in to this, or give me a link to other tutorials?

Thanks
 
First, although it still works, the tellTarget action is deprecated in Flash 5.

To get the result you wanted in Flash 5, use the following:
In the button script, comment out (add // at the beginning of the line...), all lines but the bolds.

on (rollOver) {
// if (Number(dummy) == 0) {
// tellTarget ("/animation") {
// play ();
_root.animation.play();
// }
// }
// dummy = 1;
}
on (rollOut) {
// dummy = 0;
_root.animation.gotoAndStop(1);
}

Then in the animation movie clip, add a stop(); action on frame 10, and delete frames 11 to 20.
Be careful not to delete frame 10 (fully extended position of the button), when deleting those other frames.

Flash 4 syntax would be the same. Only a stop(); action on frame 10, and the button script would look like this:

on (rollOver) {
// if (Number(dummy) == 0) {
tellTarget ("/animation") {
play ();

}
// }
// dummy = 1;
}
on (rollOut) {
// dummy = 0;
tellTarget ("/animation") {
gotoAndStop(1);

}
} Regards,

new.gif
 
I might be doing something wrong, but after I export the movie and test the button, the following happens:

1: Roll over - Button expands and stops in fully expanded state (OK)
2: Roll Out - Button jumps back to original state i.e. doesn't animate getting smaller (not OK).

Is there a way to this sort of thing using a movie clip inside a button, or is that a worse way?

Rgds
 
Sorry, I read that "jumping back" was what you wanted. I now understand that you don't want the button to pulsate, but that you only want it to animate back to it's starting position, on a roll off, is that it? And no, it wouldn't work on the button's states, you'd get the eaxct same results, even worst in a way!
Do tell me if you're using Flash 5 or 4? Regards,

new.gif
 
I'm using Flash 5. I know the example on that site is Flash 4, so sorry if it confused you.

Rgds
 
OK cracked it...

I started from fresh and did the following:

1. Created a movie clip and called it 'testbutton'
2. Created a button which was the same size and alpha'd out so you can't see it.
3. Added the following actions to the button:

on (rollOver) {
tellTarget ("testbutton") {
gotoAndPlay (2);
}
}
on (rollOut) {
tellTarget ("testbutton") {
gotoAndPlay (12);
}
}

4. In the movie clip theres 21 frames; a stop action on the 1st and 11th frame.
5. Set the frame rate high. This is because when you do a roll over and roll out quickly, you see the animation jump half way through. However, with a high frame rate you don't notice it.

I'm sure you can understand how it all worked. Anyway, thanks for the help with it.

Rgds
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top