0 Replies Latest reply on Oct 8, 2010 9:47 AM by BennyB23

    DataGrid change event

    BennyB23 Level 1

      I have a DataGrid which is serving as a playlist for a VideoPlayer component, where the current code I have which is handling the mouse-based change events is as follows:

       

      //audioDG:DataGrid...
      //mediaPlayer:VideoPlayer...
      //currentAudio:Object...     a value object represented within an ArrayCollection that the DataGrid is referencing as the dataProvider

       

       

      protected function audioDG_changeHandler(event:ListEvent):void

      {

      if (mediaPlayer.playing)

      {

      mediaPlayer.stop();

      }

      currentAudio = event.target.selectedItem as AudioItem;

      mediaPlayer.source = currentAudio.source;

      mediaPlayer.play();

      }

       

      This works fine, however what I don't know how to do, is dispatch a change event in response to an event other than the mouse event, as shown above. For starters, I'd like to dispatch an event in response to the VideoPlayer's "complete" event, which will increment the selectedIndex by one, in which case I imagine a variation of the code above will work to achieve the desired effect and play the next item. Some advice on approaching this type of change event would be greatly appreciated.

       

      Thanks~B