1 Reply Latest reply on Feb 1, 2010 5:03 AM by Sebastien V.

    newbie question about extracting data from events

    bentwonk

      HI

      i am sure there is a simple solution to this, but I am getting frsutrated  trying to extract useful data from an event:

       

      I have set up and event listner, whatching for CHANGE on a HorizontalList

       

      so far so good, event handler called when a list item is clicked, and the event is passed, but what is the syntax for getting the in particular the columnIndex, which can tantalising be seen as part of the event in debug.

       

          public function ShowGroupTab(event:Event):void{
                  var a:Number =event.target.columnIndex;
              }

       

      causes this runtime error:

       

      ReferenceError: Error #1069: Property columnIndex not found on mx.controls.HorizontalList and there is no default value.

        • 1. Re: newbie question about extracting data from events
          Sebastien V. Level 3

          First it would be better to cast your event in the proper class. In this case the event is a ListEvent. ListEvent extends Event so your code will work but be harder to maintain.

           

          Your problem is that you're trying to access the columnIndex property on the event.target instead of the event itself. The event.target is the component on which the action was performed, here it's a HorizontalList, and the list does not have a columnIndex property.

           

          Try this :

           

          public function showGroupTab(event:ListEvent):void{
               var a:int= event.columnIndex;
          }
          
          1 person found this helpful