When I was writing that e-mail I was thinking about that, as I have some code that does something similar... so, my argument may be completely wrong... needs investigation.
Anyone from Adobe care to comment? Troy. On 4/21/07, Ronnie Liew <[EMAIL PROTECTED]> wrote:
Hi Troy, U mentioned that the parent Sprite (root of app) doesn't receive mouse events because bitmap as a child object doesn't count as a drawn hitarea. In that case, how come when i create a child sprite with a bitmap child, that child spirite does receive mouse events? Going by your argument, the child sprite would need a rectangular graphic drawn too. On 4/21/07, Troy Gilbert <[EMAIL PROTECTED]<troy.gilbert%40gmail.com>> wrote: > > > > > > > The problem is that the Bitmap class is not an InteractiveObject, so it > can't receive mouse or keyboard events. And the parent Sprite (the root of > your application) doesn't receive mouse events because it doesn't have > anything drawn into its hit area (child objects, like the bitmap, don't > count). > > The easiest solution if you want to guarantee that your root sprite catches > everything is to simply fill its graphics with a rectangle with zero alpha. > You won't see anything, but all the pixels of the hit area will be set. > > Troy. > > > > On 4/19/07, Alex Harui <[EMAIL PROTECTED] <aharui%40adobe.com>> wrote: > > > > > > > > > > > > > > > > Then I would have some fullscreen child of the mainclass so the mouse has > something to hit. > > > > ________________________________ > From: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com> [mailto: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>] On > Behalf Of Ronnie Liew > > Sent: Thursday, April 19, 2007 12:46 PM > > > > To: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com> > > Subject: Re: [flexcoders] Root sprite not responding to MouseEvent ? > > > > > > > > > > > > > > Hi Alex, > > > > I am not creating a Flex Project, I am creating an Actionscript > > Project. Not too sure but in this case, I don't think the > > SystemManager is in the picture. Is that correct? > > > > On 4/20/07, Alex Harui <[EMAIL PROTECTED] <aharui%40adobe.com>> wrote: > > > > > > > > > > > > > > > > > > > > > > > > In a Flex app, the swf file's main class is SystemManager. It has some > > > children one of which is the Application. If you click anywhere on the > > > background of the application you should get mouseDown events. I do in > my > > > tests, and the target is the application because it totally covers the > > > SystemManager. > > > > > > Are you in a different topology or seeing something else? Set a > breakpoint > > > on SystemManager.as:mouseDownHandler. > > > > > > -Alex > > > > > > ________________________________ > > > From: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>[mailto: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>] On > > > Behalf Of Ronnie Liew > > > Sent: Thursday, April 19, 2007 12:15 PM > > > To: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com> > > > Subject: Re: [flexcoders] Root sprite not responding to MouseEvent ? > > > > > > > > > > > > > > > > > > > > > After some research and googling, the conclusion that I can draw is > > > that for mouse event, it is abit unusual. Apparently, the main > > > application class (which by default extends from a Sprite class), will > > > not receive mouse events directly. Mouse events seemed to be the only > > > exception, all other events like the keyboard events, enterframe work > > > fine. > > > > > > In order for the main application class to receive mouse event, it > > > must be through a child (capable of dispatching a mouse event) in the > > > its display list via bubbling or capture phase. > > > > > > According to Colin Moock, > > > "Mouse interactions with vector content drawn via the graphics > > > property of a .swf file's main class do not trigger mouse events. > > > However, mouse interactions with vector content drawn via the graphics > > > property of any other instance of InteractiveObject or its subclasses > > > do trigger mouse events. " > > > > > > So I guess, using the bitmap object probably fall under "mouse > > > interactions with vector content drawn via the graphics property"? > > > > > > > > > > > > > On 4/19/07, Ronnie Liew <[EMAIL PROTECTED]<ronnieliew%40gmail.com>> wrote: > > > > > > > > > > > the main app is a sprite, it should respond to mouse move right? > and > > > > > > it does have a child and that is the visible pixel. > > > > > > > > > > > > How come it doesn't trace out? > > > > > > > > > > Did you forget to add your Sprite to the Stage? > > > > > > > > > > e > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >