at createChildren, this.width could be 0 ________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of ben.clinkinbeard Sent: Thursday, September 27, 2007 7:29 AM To: [email protected] Subject: [flexcoders] Re: MOUSE_LEAVE never fires in IE if drag with bounds is active Dang Alex, you're the man. I never would have figured out its because of the textfield. Your proposed solution of an invisible item over the titlebar works perfectly, and since my real use case is a subclass of Panel I can easily integrate this approach. One odd thing maybe you can enlighten me on though is that it seems like I have to create the cover piece in updateDisplayList() because doing it in createChildren() doesn't work. The item isn't even visible if I create it in createChildren(). Any ideas why? Here is the code I have tried inside both methods. if(!c) { c = new Canvas(); c.x = c.y = 0; c.width = this.width; c.height = this.titleBar.height; c.setStyle("backgroundColor", 0x000000); this.rawChildren.addChild(c); } Thanks a ton, greatly appreciated. Ben --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , "Alex Harui" <[EMAIL PROTECTED]> wrote: > > One more thing: It is related to mouseDown in a TextField which is in > the Panel title. In my testing, if I grab the white content area and > drag I do not have a problem. Makes me think that if you put an alpha=0 > sprite over the textfield in the panel's title it might work better in > IE, but I don't have time to try it. > > FWIW, my test case is: > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> " > layout="absolute" > viewSourceURL="srcview/index.html" creationComplete="init()"> > <mx:Script> > <![CDATA[ > > private var lastX:Number; > private var lastY:Number; > > private function init():void > { > pnl.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown); > } > > private function onMouseDown(event:MouseEvent):void > { > lastX = event.stageX; > lastY = event.stageY; > pnl.addEventListener(MouseEvent.MOUSE_UP, onLeave); > pnl.addEventListener(MouseEvent.MOUSE_MOVE, onMove); > systemManager.stage.addEventListener(Event.MOUSE_LEAVE, onLeave); > } > > private function onMove(event:MouseEvent):void > { > var deltaX:Number = event.stageX - lastX; > var deltaY:Number = event.stageY - lastY; > > lastX = event.stageX; > lastY = event.stageY; > > pnl.move(Math.max(0, Math.min(100, pnl.x + deltaX)), > Math.max(0, Math.min(100, pnl.y + deltaY))); > > } > > private function onLeave(event:Event):void > { > pnl.removeEventListener(MouseEvent.MOUSE_UP, onLeave); > pnl.removeEventListener(MouseEvent.MOUSE_MOVE, onMove); > systemManager.stage.removeEventListener(Event.MOUSE_LEAVE, onLeave); > > } > ]]> > </mx:Script> > <mx:Panel id="pnl" width="400" height="300" title="Panel One" /> > </mx:Application> > > > ________________________________

