-
Press and hover detection
I want to detect when the mouse is pressed & held and hovered over a certain movieclip, let's call it "a"
How can I detect this action ?
-
Designer, Programmer, Musician
import flash.events.MouseEvent;
var hold:Boolean;
stage.addEventListener(MouseEvent.MOUSE_MOVE, Controls);
stage.addEventListener(MouseEvent.MOUSE_DOWN, Controls);
stage.addEventListener(MouseEvent.MOUSE_UP, Controls);
function Controls(e:MouseEvent):void
{
switch(e.type)
{
case "mouseMove":
if(hold == true)
{
trace("hold = true");
if(a.hitTestPoint(mouseX, mouseY))
{
trace('is touching "a"');
}
}
break;
case "mouseDown":
hold = true;
break;
case "mouseUp":
hold = false;
break;
}
}
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|