1 Reply Latest reply on Aug 1, 2007 6:29 AM by Santanu Karar

    Problem with DragEvent dispatcher class

    Santanu Karar Level 1
      Hi,

      I've an mxml application, an mxml component and an DragEvent(DragEvents) class in between.

      In mxml component i'm dispatching an DragEnter event through that DragEvent class, the code is as follows:

      <mx:HBox xmlns:mx=" http://www.adobe.com/2006/mxml" horizontalAlign="center" paddingTop="1" width="199" height="100%" dragEnter="doDragEnter(event,'cartFormat')" dragDrop="doDragDrop(event,'cartFormat')" backgroundColor="#ff0000">
      <mx:Metadata>
      [Event(name="itemDragged", type="events.DragEvents")]
      </mx:Metadata>
      <mx:Script>
      <![CDATA[
      import events.DragEvents;
      import mx.events.DragEvent;

      private var isDropAcceptable:Boolean = true;

      private function doDragEnter(event:DragEvent, type:String) :void {
      var o:DragEvents = new DragEvents(event, type);
      this.dispatchEvent(o);
      }
      private function doDragDrop(event:DragEvent, type:String):void {
      var o:DragEvents = new DragEvents(event, type);
      this.dispatchEvent(o);
      }

      ]]>
      </mx:Script>
      </mx:HBox>




      In the DragEvents class the code is this way:

      package events
      {
      import flash.events.Event;
      import mx.events.DragEvent;

      public class DragEvents extends DragEvent
      {
      public var event:DragEvent;

      public function DragEvents(event:DragEvent, type:String){
      super(type);
      this.event = event;
      }

      public override function clone():Event {
      return new DragEvents(event, type);
      }
      }
      }

      But the problem is the 'public override function clone' which is returning an Event object, couldn't passing any DragEvent event or simply is not working! I've no idea how could I return this DragEvent to the main mxml App.! If somehow I could dispatch this DragEvent to my main app, then it'll be a real helpful for me.


      Please suggest.


      Tnks,

      ASB