-
1. Re: MouseEvents in Flash CS4 (AS3)
Rothrock Mar 17, 2010 1:57 PM (in response to Me2LoveIt2)var isPressed:Boolean=false;
stage.addEventListener(MouseEvent.MOUSE_DOWN,handleMouse);
stage.addEventListener(MouseEvent.MOUSE_UP,handleMouse);
function handleMouse(e:MouseEvent):void{
isPressed = !isPressed
}
function mousePos( e:MouseEvent ):void{
if(isPressed){//This is where i need some help I don't know how to check if the mouse is DOWN.
//do cool stuff here
}else if(mouseX < (stage.stageWidth / 4)){
mDs = ((mouseX - (stage.stageWidth / 4))^2)/((stage.stageWidth / 4)/20);
}else if(mouseX > ((stage.stageWidth / 4)* 3)){
mDs = ((mouseX - ((stage.stageWidth / 4)* 3))^2)/(((stage.stageWidth / 4))/20);
}else{
mDs = 0.5;
}
} -
2. Re: MouseEvents in Flash CS4 (AS3)
Ross Ritchey Mar 18, 2010 12:53 PM (in response to Rothrock)Actually, you can check directly via a parameter of the MouseEvent class:
function mousePos( e:MouseEvent ):void{ if(e.buttonDown){ //do cool stuff here }else if(mouseX < (stage.stageWidth / 4)){ mDs = ((mouseX - (stage.stageWidth / 4))^2)/((stage.stageWidth / 4)/20); }else if(mouseX > ((stage.stageWidth / 4)* 3)){ mDs = ((mouseX - ((stage.stageWidth / 4)* 3))^2)/(((stage.stageWidth / 4))/20); }else{ mDs = 0.5; } }

