View Full Version : Simple button question
Frankstolpe
12-24-2002, 12:08 PM
Hi
What is the code for letting a button rotate for 180 degrees on mouseover?
I dont want to work with motion tweens.
Thanks in advance
frank
Grifter
12-24-2002, 06:20 PM
depending on whether you want a tween effect or just jump straight to the 180 degrees, you can do two things. i reckon you want to do the first option so you want to slap this on the button:
on(rollOver){
if(this._rotation<=180){
this._rotation++;
}
}
and if you want to reset it after, then
on(rollOut){
this._rotation = 0;
}
hope this helps
Grifter
Frankstolpe
12-24-2002, 07:49 PM
Thanks
but i doesnt seem to help
just look at the attachment
sonic_2k_uk
12-24-2002, 10:54 PM
try this actionscript in the buttons actions. Also name the button's instance button.
on (rollOver) {
setProperty("button", _rotation, _root.button._rotation +180);
}
on (rollOut) {
setProperty("button", _rotation, _root.button._rotation +180);
}
Andy Burton
Frankstolpe
12-25-2002, 12:48 PM
sorry
can't get it to work
can someone please tell me what i am doing wrong here
thanks
cheez
12-25-2002, 06:19 PM
Howdy, please try:
///////////on rollover and rollout/////////////
on (rollOver) {
this._rotation =90;
}
on (rollOut) {
this._rotation = 0;
}
//////////////////////////////////////////////////////
1. BTW, in the future, to de-bug such a thing and of course to make it work the way I think you want it to, a rotation of +/- 180 will give *EXACTLY* the same effect as *ZERO* rotation. Your button graphic is symmetrical in that way.
2. Just so you know, I reset your button to an MC as opposed to a "button" under properties. "this" refers to your button and is what finally made the script perform to your spec. I am a major newb to a.s. so I don't know if this makes difference or not!
See ya and Hap Hol,
Cheez
Originally posted by Frankstolpe
sorry
can't get it to work
can someone please tell me what i am doing wrong here
thanks
cheez
12-25-2002, 06:43 PM
Hehe, this effect *does not work* if your object is a "button" as opposed to "mc".
See ya,
Cheez
Originally posted by cheez
Howdy, please try:
///////////on rollover and rollout/////////////
on (rollOver) {
this._rotation =90;
}
on (rollOut) {
this._rotation = 0;
}
//////////////////////////////////////////////////////
1. BTW, in the future, to de-bug such a thing and of course to make it work the way I think you want it to, a rotation of +/- 180 will give *EXACTLY* the same effect as *ZERO* rotation. Your button graphic is symmetrical in that way.
2. Just so you know, I reset your button to an MC as opposed to a "button" under properties. "this" refers to your button and is what finally made the script perform to your spec. I am a major newb to a.s. so I don't know if this makes difference or not!
See ya and Hap Hol,
Cheez
Frankstolpe
12-26-2002, 09:01 AM
thanks
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.