Thanks,Gordon!

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
layout="vertical">
<mx:Script>
        <![CDATA[
        import mx.controls.Alert;
                
                        private function mouseDoubleClickListener
(event:MouseEvent):void
                        {
        
                                        var cmt:Sprite=new 
Sprite();
                                        
                                        cmt.graphics.lineStyle
(2,0x000000,1);
                                        cmt.graphics.beginFill
(0xff0000,1);
                                        cmt.graphics.drawCircle
(event.localX,event.localY,10);                         
        
                                        cmt.graphics.endFill();
                                        a.rawChildren.addChild
(cmt);
                                        cmt.addEventListener
(MouseEvent.ROLL_OVER, mouseOverListener);
                                        cmt.addEventListener
(MouseEvent.ROLL_OUT, mouseOutListener);
                        //}
                        }
                        
                        private function mouseOverListener
(event:MouseEvent):void                         
                        {                               
                                Alert.show("rollover");
                                
                        }
                                
                        private function mouseOutListener
(event:MouseEvent):void                         
                        {                               
                                Alert.show("rollout");
                        }
                        
        ]]>
</mx:Script>
        <mx:Panel id="a">
                <mx:Canvas id="b" width="500" height="500" 
doubleClick="mouseDoubleClickListener(event)" 
doubleClickEnabled="true"/>
        </mx:Panel>
</mx:Application>

Run the code and the problem is obvious.

Regards.

--- In [email protected], "Gordon Smith" <[EMAIL PROTECTED]> wrote:
>
> It's not obvious to me why that would be happening.  Can you post 
the
> code for a simple app which demonstrates the problem?
>  
> - Gordon
> 
> ________________________________
> 
> From: [email protected] 
[mailto:[EMAIL PROTECTED] On
> Behalf Of Sandwish
> Sent: Tuesday, February 27, 2007 11:22 AM
> To: [email protected]
> Subject: [flexcoders] How does sprite listener work?
> 
> 
> 
> I new a sprite and addeventlistener which listens roll_over and
> roll_out event. But after a circle is drawn with beginfill and
> endfill, each time I roll inside the circle, both events get 
invoked.
> I don't know why? :(
> 
> Thanks in advance!
> Regards,
> Sand
>


Reply via email to