I've got a component with a button (called dragBar) on it. The listener is set up as:

<firstComp>
   dragBar.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);

  private function onMouseDown(e:MouseEvent):void  {                  
       e.stopPropagation();
       dispatchEvent(new DragItemEvent(MouseEvent.MOUSE_DOWN, e.stageX, e.stageY));
   }
</firstComp>

I'm firing a custom event, as you can see (DragItemEvent). This is caught in a second component using this:

<secondComp>
   firstComp.addEventListener(DragItemEvent.MOUSE_DOWN, onMouseDown);

    private function onMouseDown (e:DragItemEvent):void {
        //do stuff..
    }
</secondComp>

package com.imagetrend.events
{
    import flash.events.Event;
   
    public class DragItemEvent extends Event
    {
        public static const MOUSE_DOWN:String = "mouseDown";
       
        public var stageX:Number;
        public var stageY:Number;
       
        public function DragItemEvent(type:String, x:Number, y:Number) {
            super(type, true, true);   
            stageX = x;
            stageY = y;
        }
    }
}

When I add flex buttons to the first component there's no problems.
My problem is when I add a UIcomponent such as ControlBar or anything that scrolls, the onMouseDown() still fires in the first, but I'm no longer catching that DragItemEvent in the second component. Any ideas why flex's components would mess up my dispatching or listening?

--

: : ) Scott

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to