PDA

View Full Version : Increasing a property's value


Martha Tabram
11-27-2001, 08:18 AM
Wotcha, folks.

My first post here, so please be gentle with me.

I have a graphic that I'd like to rotate when a user hovers over a mouse button. Idealy, I'd like it to stop when the button is pushed.

Question 1.

I can rotate the button, but only one increment. How do I create something like _rotation = _rotation + 1 while the cursor hovers over the button ?

Question 2.

How do I apply different actions to different button instances? It doesn't seem to want to let me enter actionscript to each of the button's 4 frames.


Many thanks in advance.

Martha.:D

Jesse
11-27-2001, 08:46 AM
Q2. The code goes ON the button, not on each of its frames. When you plac eit on the button you can specify which event you want to trigger the action, such as:
on (release) {
}
// or
on (rollOver) {
}
and you can add combinations of these to achieve the effects you want.

Q1. Make you button set a variable when the user puts their mouse over it:
on (rollOver) {
_root.go = true;
}
then have a looping MC which waits for that variable to be true, by putting this code ON an MC:
onClipEvent (enterFrame) {
if (_root.go) {
_root.yourInstance._rotation += 1;
}
}
where 'yourInstance' is the instance name of the object you wish to rotate.
note that += 1 means add 1 to the current value.

Martha Tabram
11-27-2001, 10:19 AM
Cheers, Jesse.

It took me a while to suss out that I could only enter that stuff in expert mode, but I got there in the end.

Great site btw.

Martha