Copy link to clipboard
Copied
I have a button that will rotate an object in its parent by 90 degrees every time its clicked:
b_rotate_CW.addEventListener(MouseEvent.CLICK, rotateCW);
function rotateCW(event:MouseEvent):void
{
Object(this).parent.module.rotation += 90;
}
Which is fine, but I think it would be a nice touch if the object's rotation were animated.
I tried this:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
b_rotate_CW.addEventListener(MouseEvent.CLICK, rotateCW);
function rotateCW(event:MouseEvent):void
{
var rCW:Tween = new Tween(Object(this).parent.module, "rotate", Strong.easeOut, 0, +90, .5, true);
}
... but it does nothing at all, I am guessing that "rotate" is a property option, I can find no documentation for that, only x, y, their scale and alpha.
I'm sure this has been done by many, can anyone offer a helpful clue as to how this function would be properly coded?
Thanks!
Thats brilliant, I tweaked it a little; replaced the 0 with the current angle of the clip) and now it works perfectly:
var rCW:Tween;
b_rotate_CW.addEventListener(MouseEvent.CLICK, rotateCW);
function rotateCW(event:MouseEvent):void
{
rCW = new Tween(Object(this).parent.module, "rotation", Strong.easeOut, Object(this).parent.module.rotation, Object(this).parent.module.rotation+90, .5, true);
}
Who would have known you could use a target path in place of a value?
Where can everyone learn AS3 as you know
...Copy link to clipboard
Copied
use:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
var rCW:Tween;
b_rotate_CW.addEventListener(MouseEvent.CLICK, rotateCW);
function rotateCW(event:MouseEvent):void
{
rCW = new Tween(Object(this).parent.module, "rotatation", Strong.easeOut, 0, Object(this).parent.module.rotation+90, .5, true);
}
Copy link to clipboard
Copied
Thats brilliant, I tweaked it a little; replaced the 0 with the current angle of the clip) and now it works perfectly:
var rCW:Tween;
b_rotate_CW.addEventListener(MouseEvent.CLICK, rotateCW);
function rotateCW(event:MouseEvent):void
{
rCW = new Tween(Object(this).parent.module, "rotation", Strong.easeOut, Object(this).parent.module.rotation, Object(this).parent.module.rotation+90, .5, true);
}
Who would have known you could use a target path in place of a value?
Where can everyone learn AS3 as you know it?
Thank you again for your immense help!
Copy link to clipboard
Copied
you're welcome.