1000117_DisplayObject__mouseX_rotationY_1.swf
import flash.ui.Mouse;
import flash.events.MouseEvent;
import caurina.transitions.Tweener;
//
var flag:int;
//
plane.x = stage.stageWidth/2;
plane.y = stage.stageHeight/2;
//
this.addEventListener(MouseEvent.MOUSE_MOVE, rotateZ);
this.addEventListener(MouseEvent.ROLL_OUT, zeroY);
//
function rotateZ(e:MouseEvent):void{
var keyX:Number = stage.stageWidth/2;
if(mouseX > keyX){
flag = 1;
//plane.rotationY = 30;
rotateTween();
}else if(mouseX < keyX){
flag = -1;
//plane.rotationY = -30;
rotateTween();
}
}
//
function rotateTween():void{
Tweener.addTween(plane, {
rotationY :flag*30,
time :1.2
});
}
//
function zeroY(e:MouseEvent):void{
Tweener.addTween(plane, {
rotationY :0,
time :1
});
}
沒有留言:
張貼留言