MOUSE_OVER

16 posts

Flag Post

Hey, is there an easy way to know when any button in a SWF has been mouse-overed, without adding a listener to each button?

 
Flag Post

So you want to check for an event without using an event listener? Perhaps witchcraft is what you’re looking for.

 
Flag Post

What’s the motivation behind your request?
What are you trying to do?

You can add it in the class of your buttons.
That’d still add it to every object, but the adding is happening in “one place” code wise.

You can add the listener to the document class and let the Events bubble up.
This however does not necessarily give you access to the button object via .target, if it has mouseChildren.

 
Flag Post
Originally posted by Aesica:

So you want to check for an event without using an event listener? Perhaps witchcraft is what you’re looking for.

Thanks for helping…

Originally posted by NineFiveThree:

What’s the motivation behind your request?
What are you trying to do?

You can add it in the class of your buttons.
That’d still add it to every object, but the adding is happening in “one place” code wise.

You can add the listener to the document class and let the Events bubble up.
This however does not necessarily give you access to the button object via .target, if it has mouseChildren.

I want to add a glow filter to my cursor when it is hovering over a SimpleButton clip, the .target property is not needed.

What could be possible is to overwrite the mouseover function of the SimpleButton class to tell when I have hovered the mouse over a button. What would you say about that 953?

 
Flag Post

Isn’t this the realm of the built-in native cursor replacement API?

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/ui/Mouse.html

 
Flag Post

+1 on the custom cursor

 
Flag Post

I actually wrote a short tutorial on how to use the custom cursor API back when I actually thought spending time to maintain a blog was a good idea. (I know, crazy right?)

Anyway, here’s the link, maybe it will help, maybe not.

 
Flag Post

I suspect getObjectsUnderPoint() is what you’re looking for.

function mouseOverButton():Boolean {
	for each(var object:DisplayObject in stage.getObjectsUnderPoint(
				new Point(stage.mouseX, stage.mouseY))) {
		if(object is SimpleButton) {
			return true;
		}
	}
	return false;
}
 
Flag Post
Originally posted by Aesica:

So you want to check for an event without using an event listener? Perhaps witchcraft is what you’re looking for.

Not too long ago, I read a blog post of an AS3 coder who said that whenever he sees events in anybody’s code, he immediately replaces them with callback functions. I haven’t seriously looked into the performance of events versus callbacks, but it’s something that I’ve been meaning to check out someday.

Originally posted by BobTheCoolGuy:

I actually wrote a short tutorial on how to use the custom cursor API back when I actually thought spending time to maintain a blog was a good idea. (I know, crazy right?)

(Elyzius hides his blog under a rug.)

Anyway, here’s the link, maybe it will help, maybe not.

Uh, Bob, I don’t think Chrome likes SWFCabin at all.

 
Flag Post

Elyzius: Oh my. That’s quite the surprise. Well, my apologies if somehow it contains malware, although I highly doubt it does. Coincidentally, URLVoid show’s it’s clean. That being said, don’t take any risks on the internet.

 
Flag Post
Originally posted by BobTheCoolGuy:

Elyzius: Oh my. That’s quite the surprise. Well, my apologies if somehow it contains malware, although I highly doubt it does. Coincidentally, URLVoid show’s it’s clean. That being said, don’t take any risks on the internet.

FTFY ;)

 
Flag Post

Well, Bob’s a cool guy. I’m sure all his SWFs are safe. The same cannot be said for some of the SWFs that have been uploaded to SWFCabin. One can code malware with Actionscript, and apparently some people have. Any repository of SWFs can potentially harbor malware. One can only hope that the people who upload their files to FastSWF have nothing but good intentions. Hopefully, user registration and a login screen can be implemented in FastSWF soon so that if anyone uploads malware, you’ll know who’s the guilty party.

 
Flag Post
Originally posted by Elyzius:

Not too long ago, I read a blog post of an AS3 coder who said that whenever he sees events in anybody’s code, he immediately replaces them with callback functions. I haven’t seriously looked into the performance of events versus callbacks, but it’s something that I’ve been meaning to check out someday.

Do you still have the link? I find the event system clunky, but I’ve never found a way to bypass it that didn’t also involve breaking encapsulation. I’d be very curious to see how this guy went about it.

 
Flag Post

^ Likewise, although I’ve found that making a self-cleaning sprite class helps tone down the clunkiness a bit. I didn’t actually know it was possible to bypass it altogether, so this is of interest.

 
Flag Post

I can’t find the guy’s blog for the life of me. I never bothered to bookmark it because the author struck me as rather peculiar. Aside from replacing events with callbacks when changing someone else’s code, he also said that he deletes all comments until none are left. Surely comments have no effect on SWF performance, right?

Nevertheless, the idea of replacing events with callbacks did not seem to originate from him. The genius behind this idea is apparently Robert Penner, whom I am absolutely certain is not the same man who slaughters innocent comments without mercy. If you want to read about Signals, Penner’s alternative to AS3 events, click here.

For further reading, you may want to click this, this, and this.

 
Flag Post

Thank you very much, the first ‘this’ link actually explained it really well. As for scrubbing all comments on sight… well, I’m no friend of comments myself (I am of the opinion that proper code should be self-evident and that finding a good variable/function name is a better use of one’s time than writing a comment to justify or explain a bad name) but I still find that attitude extreme.