如何在JSP页面中加载flash播放器,要求有播放、暂停等控件,可以播放.swf、.flv等文件。
------最佳解决方案--------------------------------------------------------
Flex 的,跟html语法差不多,在网上随便找的改了改,楼主有需要的话在后面跟帖我给你编译成swf或者直接编译成html给你用,至于播放的源文件,在flv.xml里面配置
<?xml version="1.0" encoding="UTF-8"?>
<flv label="所有视频">
<flv label="校内men" source="xlm.flv"/>
</flv>
firstapp.mxml源码:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" xmlns:file="file.*" paddingTop="20">
<!-- <mx:Style source="css/Styles.css"/>-->
<mx:Script>
<![CDATA[
import mx.events.SliderEvent;
import mx.events.VideoEvent;
import mx.controls.Alert;
import mx.events.ListEvent;
private var w:int;
private function init():void{
w=twLeft.width;
}
private var flvUrl:String;
/* 获取选择的文件,赋值给播放器做为源 */
private function chooseFlv(event:ListEvent):void{
//Alert.show(Tree(event.target).selectedItem.@source);
flvUrl=Tree(event.target).selectedItem.@source;
this.vd.source=flvUrl;
}
//也可以双击播放
private function itemPlay(event:MouseEvent):void{
this.vd.source=flvUrl;
this.vd.play();
}
/*播放或暂停 */
private function paly():void{
if(vd.playing){
this.btnPlay.label="Play";
this.vd.pause();
}else{
this.vd.play();
this.btnPlay.label="Pause";
}
vd.addEventListener(VideoEvent.PLAYHEAD_UPDATE,videoHandle);
}
//stop play
private function stop():void{
if(vd.playing){
this.vd.stop();
this.btnPlay.label="Play";
}
}
private function videoHandle(event:VideoEvent):void{
this.hsLength.value=vd.playheadTime;
if(hsLength.value==hsLength.maximum){
this.btnPlay.label="Play";
}
}
//改变音量
private function changeSound():void{
vd.volume=this.hsSound.value;
}
//全屏
private function fullScreen():void{
//stage.displayState="fullScreen";
stage.displayState=StageDisplayState.FULL_SCREEN;
twLeft.width=twLeft.minWidth;
}
//格式化时间
private function formatTimes(value:int):String{
var result:String = (value % 60).toString();
if (result.length == 1){