jeudi 24 décembre 2015

Check VideoDisplay video is not null in flex

I have datagrid which contains number of rows which have video data.

<s:DataGrid id="movieGrid" dataProvider="{movieData}" selectionChange="setSource(event)" />

On selection of row get video url and play in VideoDisplay.

private function setSource(event:GridSelectionEvent):void
{
    if(videoDisplay!=null)
    {

        var movie:String = movieGrid.selectedItem.flvLink;
        videoDisplay.source = movie;
     }
}

And on play select it will play the video.

videoDisplay.play();

VideoDisplay:

<s:VideoDisplay id="videoDisplay"  autoPlay="false" />

Now that moveData values come from server request.

Problem:
Above works well but, Some of flvlink are wrong, which does not have videos.
Now i click on that row which have wrong link and again click on right link row then it have error in videodisplay.

TypeError: Error #1009: Cannot access a property or method of a null object reference.

How, can i skip this error. Is there are anyway i can get that link has video file or not. And if not then not apply source to video display?

Aucun commentaire:

Enregistrer un commentaire