My boss is making me do this flash project and I am not a flash expert.
I have a circle(like a clock) and when you choose a cell it should rotate to the 12 oclock position. I can't get this to work.....arrrg I need a drink .
I'm not sure what you mean by "cell" but one way you could do this is make the "cell" a button. then you the button on handler. click the button and put this code on its action pane:
Code:
on(release)
{
//code to change the clock positions
//The way I would do it is just declare the x
//position, y position, and rotation angle of
//the hands. You could also just have the hands
//in the beginning position and have the alpha
//at 100% but also draw hands at the 12 o'clock
//position but make the alpha of them 0%. On
//the release of this button, just make the
//beginning hands' opacity 0% and the 12 o'clock
//hands' opacity 100%
}
If the cell is a text box then the on(release) handler will not be good. You would then have to use a different handler for focus events. I don't remember the exact name of the function but it's something like:
Code:
yourTextBox.onGetFocus()=function
{
//the same code as in the block above
}
Note that this code would go on your main timeline action pane and not the text box's action pane. Remember to find the correct name and syntax for the focus event also because I am a bit rusty on that part.
If all you have to do is make that spin then you just change the anlge of rotation in the on handler. If you want it to animate and not just appear at the final position you could either have a motion tween set up and play that when something is clicked or you can use the onClipEvent(enterFrame){} function and change the angle by a certain increment in each frame. In case you don't know, you have to put onClipEvent(enterFrame){} in a movie clip's action pane. This function is run every time the frame is entered so if your movie is at 24 fps, then the function is run 24 times each second. An eash way to do this is to define a flag variable such as:
Code:
var check:String = "DON'T"
The button code would be something like:
Code:
on(release)
{
_root.check = "DO";
}
and have the onClipEvent be something like this:
Code:
onClipEvent(enterFrame)
{
if(_root.check=="DO")
{
//change the angle of rotation
//by a certain increment.
}
}
It would be much easier to just make a motion tween if it works for what you want to do.
hum's solution is okay if you want to run it like an image viewer, but my understanding was that when you click a certain panel it rotated to the top automatically. I (after nearly crippling my poor brain!) came up with a system that does just that - file is attached.
Hope it's what you were after.
----------
"Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life." TERRY PRATCHETT
Huh?
The fla I sent does exactly that!
You click on a cell then it will rotate
the circle until it reaches the 12 o'clock position.
Can you explain what you mean when you say "run it like an image viewer" ?
Or maybe you didn't view the fla i sent.
As it is doing exactly the same as yours!!
hum ... my most sincere apologies! I only have Flash MX, so I couldn't run your FLA, and from the quick glance I gave your code it didn't look like it did what it turns out it does! And much more eloquently than my damned fiddley math-based solution, too!
I'm gonna modify my footer to warn people I can't view FLAs from anything over version 6
More haste, less speed ... sorry!
----------
"Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life." TERRY PRATCHETT