albisher
08-04-2007, 06:39 AM
i was planning to make my cursor redirect as the mouse move on stage
it did work but not as i expected it is something related to center
var rotationIs:Number = this.cursor.rotation;
this.cursor.x = stage.stageWidth/2;
this.cursor.y = stage.stageHeight/2;
//
stage.addEventListener(MouseEvent.MOUSE_MOVE, CReplace);
Mouse.hide();
//
function CReplace(event:MouseEvent):void
{
this.cursor.x= mouseX;
this.cursor.y= mouseY;
this.cursor.visible = true;
if (Mouse.hide()== false){
Mouse.hide();
}
//
this.cursor.rotation = ((Math.atan2(mouseY,mouseX))*180/Math.PI);
trace("rotationIs = "+((Math.atan2(mouseY,mouseX))*180/Math.PI));
};
but what i was thinking to do is to have something like
mouseXnow = mouseX;
but i do not know how to make the previus mouseX position?
i was planning to make the direction as if
directionX = mouseXnow - mouseXprev;
actually i did get lost ... any ideas or how to deal with such thing?
it did work but not as i expected it is something related to center
var rotationIs:Number = this.cursor.rotation;
this.cursor.x = stage.stageWidth/2;
this.cursor.y = stage.stageHeight/2;
//
stage.addEventListener(MouseEvent.MOUSE_MOVE, CReplace);
Mouse.hide();
//
function CReplace(event:MouseEvent):void
{
this.cursor.x= mouseX;
this.cursor.y= mouseY;
this.cursor.visible = true;
if (Mouse.hide()== false){
Mouse.hide();
}
//
this.cursor.rotation = ((Math.atan2(mouseY,mouseX))*180/Math.PI);
trace("rotationIs = "+((Math.atan2(mouseY,mouseX))*180/Math.PI));
};
but what i was thinking to do is to have something like
mouseXnow = mouseX;
but i do not know how to make the previus mouseX position?
i was planning to make the direction as if
directionX = mouseXnow - mouseXprev;
actually i did get lost ... any ideas or how to deal with such thing?