View Full Version : mouse events... why are they so lame?
theonlycarmire
May 12th, 2007, 01:19 AM
Is it just me, or does this new method of dealing with mouse events (release, press, etc..) plainly stupid? One gripe I have immediately is the loss of the mouse pointer. Instantly I noticed that using the following code:
function clickEvent(event:MouseEvent){
trace("clicked");
trace(event);
}
mc.addEventListener(MouseEvent.MOUSE_UP, clickEvent);...had me mousing over my movieclip called "mc" and not showing the mouse pointy-hand like I saw and loved in as2.0...
Is there a way to keep that around, or has Adobe simply left out one of the program's most user-friendly indication techniques?
-Josh
TheCanadian
May 12th, 2007, 01:57 AM
mc.buttonMode = true;
annettegeek
May 14th, 2007, 06:46 PM
ActionScript Code:
mc.buttonMode = true;
To get the same effect for a button component, there is yet another property:
myButton.useHandCursor =true;
Yikes. Learning AS3 is going to be a climb ;-<
duncanhall
May 14th, 2007, 07:38 PM
Sweet jesus. I'm still holding off on CS3 for just a little bit longer, but it looks like I've got a lot of stuff to unlearn.
FizixMan
May 14th, 2007, 07:54 PM
Since AS3 is more typesafe and compliant with coding standards and ECMAScript compliant, it's more of a matter of stuff to learn than unlearn I suppose.
dthought
May 14th, 2007, 09:18 PM
I also noticed that there is no equivalent onReleaseOutside - they say to just use mouseUp.
Now for a few seconds I was thinking "This is a terrible loss of functionality! What if you want to reject a click?"... then I realised that I should instead do a hit test between the mouse and the object I am detecting the click for. If it fails, they have released outside. Of course, then you have to worry about dereferencing things so the garbage collector can retrieve your now-discarded Point instances (if that's what you've used, for example). Eiii.
So yes, AS3 is an uphill battle for AS1 / 2 afficionados, but it is very clever in its abstraction and opens the door to a lot of functionality.
annettegeek
May 15th, 2007, 11:12 AM
I'll try to keep those encouraging words in mind. I've been reading through the AS3 Cookbook -- but most of what I'll end up doing will NOT involve using external .as files, nor Flex. So...I guess that leaves me trawling the Help files in Flash ;-<
(discovered RegExp the other day. Now that's a class that will make my life a lot easier!)
senocular
May 15th, 2007, 11:34 AM
I also noticed that there is no equivalent onReleaseOutside - they say to just use mouseUp.
Now for a few seconds I was thinking "This is a terrible loss of functionality! What if you want to reject a click?"... then I realised that I should instead do a hit test between the mouse and the object I am detecting the click for. If it fails, they have released outside. Of course, then you have to worry about dereferencing things so the garbage collector can retrieve your now-discarded Point instances (if that's what you've used, for example). Eiii.
So yes, AS3 is an uphill battle for AS1 / 2 afficionados, but it is very clever in its abstraction and opens the door to a lot of functionality.
http://www.kirupa.com/forum/showthread.php?p=1948182#post1948182
sarahelizabeth
May 15th, 2007, 01:35 PM
As an alternative to senocular's onReleaseOutside method, you can try:
function mouseUpHandler(e:MouseEvent):void{
if(e.target != targ){
//do release outside actions
}
}
targ.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.