0 Replies Latest reply on Dec 19, 2008 9:53 PM by Raju Rao

    event dispatch between two objects not received

    Raju Rao
      Hi,

      In my application there are two objects: one is myAc:ArrayCollection and the second is a mySprite:Sprite. myAC stores coordinates and other custom fields of the mySprite objects.

      I would like the sprite object to dispatch an event to the array so that when changes are made to the mySprite object the myAC can update itself.

      In the mySprite object I have added the following code to dispatch the event.
      ..
      var e:Event = new Event("spriteMove", true);
      dispatchEvent(e);
      trace("dispatched");
      ...


      In the myAC object I have set the following listener
      ..
      this.addEventListener("spriteMove", spriteMoveHandler, true);

      private function spriteMoveHandler( event:Event ):void
      {
      trace("recd event");
      var sp:Object = event.target;
      trace(sp.x);
      ..
      }

      I do not receive the event in the myAC object.

      However, when I set a similar thing between the mySprite object and one of its subobjects viz. myPoint I am able to receive the event.

      Thanks for the help,

      Raju