| |||||||||||||||||||||||||||||||
|
problem pertaining to your issue is that it doesn't take into consideration depth. It is still more process intensive then just firing a callback on rollOver but could be useful for you and give you some ideas: class com.domain.RollWhileWithin extends MovieClip { public var rolled:Boolean; function RollWhileWithin () { rolled = false; } public function doRollOver():Void { if (!rolled) { rolled = true; gotoAndStop("over"); } } public function doRollOut():Void { if (rolled) { rolled = false; gotoAndStop("up"); } } } One level above it, you can manage as many clips as there are. var checkMouseInterval:Number; clearInterval(checkMouseInterval); checkMouseInterval = setInterval(this, "checkMouse", 100); private function checkMouse():Void { var i:Number = 5; while (i--) { var clip:MovieClip = this["MC_RollClip" + i]; if (_xmouse > clip._x && _xmouse < clip._x + clip._width && _ymouse > clip._y && _ymouse < clip._y + clip._height) { clip.doRollOver(); } else { clip.doRollOut(); } } } -----Original Message----- From: flashcoders-bounces [mailto:flashcoders-bounces] On Behalf Of Vishal Kapur Sent: Thursday, February 08, 2007 11:19 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] determining which object is displayed at agivenpoint Ok. This is what I was missing. Thanks to Karina and Erik for pointing out that you need to compare the entire parent chain of two objects to figure out which one is being rendered above the other. The only thing to add is that in addition to checking depths, the _visible property needs to be checked for the parent chain for each object (so if _visible is false anywhere in the parent chain, I consider that object to be invisible). This works in all cases except for some TextFields, where the bounding box of the textfield object is bigger than the area actually occupied by the text. This can be solved with a custom hitTest() implementation that uses Textfield.textWidth and .textHeight to get the bounding box of the displayed text. An interesting corollary is that this method would be a way to implement onRollOver for TextFields (if that ever proves useful to anyone). Steven, I'm not familiar with the class you're referring to. Could you send the link to it? I'm always looking to improve the simplicity and efficiency of my code... -- Vishal On 2/8/07, Steven Sacks | BLITZ <ssacks> wrote: > I think the class I wrote works well enough, I actually pulled it out of > an app I'm working on with complex rollovers like that. Why not > consider my way? It's simple, easy and, most importantly, it works. It > hardly takes any processing power, too. > > > _______________________________________________ > Flashcoders > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > _______________________________________________ Flashcoders To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com _______________________________________________ Flashcoders To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
| ||||||||||||||||||||||||||||||
© 2004-2008 readlist.com