1 Reply Latest reply on Feb 3, 2010 5:09 PM by pauland

    EventListener never receiving an event

    bitwyse Level 1

      I have an application broken into several mxml files.  In one file I have a data grid with a change event that calls this function:

       

      private function selectProperty( event : Event ) : void
      {
           dispatchEvent( new Event( eventPropertySelect.PROPERTY_SELECT, event.target.selectedLabel ) );
           trace( "You selected: " + event.target.selectedLabel , "Yo!" );
      }

        • 1. Re: EventListener never receiving an event
          pauland Level 4

          bitwyse wrote:

           

          I have an application broken into several mxml files.  In one file I have a data grid with a change event that calls this function:

           

          private function selectProperty( event : Event ) : void
          {
               dispatchEvent( new Event( eventPropertySelect.PROPERTY_SELECT, event.target.selectedLabel ) );
               trace( "You selected: " + event.target.selectedLabel , "Yo!" );
          }

           

           

          The Event constructor is passing "event.target.selectedLabel" as the bubbles boolean parameter. That doesn't look right.

           

          If you are trying to pass event.target.selectedLabel as data, you'll need to create a custom event.

           

          Besides that, picking up an event depends upon where the event listener is and whether the event bubbles. Difficullt to know from such little code.

           

          Google actionscript event bubbling.

           

          Paul