Mega Code Archive

 
Categories / Flex / Graphics
 

Detecting a connection error when loading an FLV with the VideoDisplay control

<?xml version="1.0" encoding="utf-8"?> <mx:Application name="VideoDisplay"                 xmlns:mx="http://www.adobe.com/2006/mxml">     <mx:Script>                      import mx.controls.Alert;             import mx.events.VideoEvent;             private function onError(evt:VideoEvent):void {                 switch (evt.state) {                     case VideoEvent.CONNECTION_ERROR:                         evt.currentTarget.visible = false;                         Alert.show(evt.currentTarget.source, "Failed to connect to video");                         break;                 }             }            </mx:Script>     <mx:VideoDisplay id="videoDisplay"             source="http://server.com/a.flv"             stateChange="onError(event);" /> </mx:Application>