<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="init();">
<mx:Style source="main.css"/>
<mx:VideoDisplay id="videoDisplay" width="100%" height="100%" autoPlay="false" autoRewind="false"
close="doVideoEvent(event);" complete="doVideoEvent(event);"
playheadUpdate="doVideoEvent(event);" progress="doProgressEvent(event);"
ready="doVideoEvent(event);" rewind="doVideoEvent(event);" source="{FLV_URL}"/>
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.events.CuePointEvent;
import mx.events.VideoEvent;
[Bindable]
private var arrColl:ArrayCollection;
[Bindable]
private var FLV_URL:String ;
private var CALLBACK_FUNC:String;
/**
* Initialize the ArrayCollection object.
*/
private function init():void {
arrColl = new ArrayCollection();
FLV_URL = "http://edge.v.iask.com.lxdns.com/56216392.hlv?KID=sina,viask&Expires=1422979200&ssig=gbTMXDw0ui";
CALLBACK_FUNC = "jsCallback";
}
private function doVideoEvent(evt:VideoEvent):void {
ExternalInterface.call(CALLBACK_FUNC,evt.toString());
}
private function doCuePointEvent(evt:CuePointEvent):void {
ExternalInterface.call(CALLBACK_FUNC,evt.toString());
}
private function doProgressEvent(evt:ProgressEvent):void {
ExternalInterface.call(CALLBACK_FUNC,evt.toString());
}
public function doJS(par1:String,par2:String):String{
if(par1 == "URL"){
if(par2=="")
return FLV_URL;
else
return FLV_URL = par2;
}else if(par1 == "state"){
return videoDisplay.state;
}else if(par1 == "volume"){
if(par2 == "")
return String(videoDisplay.volume);
else
videoDisplay.volume = Number(par2);
}else if(par1 == "play"){
videoDisplay.play();
}else if(par1 == "pause"){
videoDisplay.pause();
}else if(par1 == "stop"){
videoDisplay.stop();
}else if(par1 == "callback"){
if(par2 == "")
return CALLBACK_FUNC;
else
CALLBACK_FUNC = par2;
}
return "";
}
]]>
</mx:Script>
</mx:Application>