我有这个代码正常工作,但我需要将视频ID作为变量从php(取自数据库)中传递出来:
AS3代码:
package test_fla
{
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.system.*;
dynamic public class MainTimeline extends MovieClip
{
public var pause_btn:Button;
public var play_btn:Button;
public var my_player:Object;
public var my_loader:Loader;
public function MainTimeline()
{
addFrameScript(0, this.frame1);
this.__setProp_pause_btn_Scene1_Layer1_0();
this.__setProp_play_btn_Scene1_Layer1_0();
return;
}// end function
public function onLoaderInit(param1:Event) : void
{
addChild(this.my_loader);
this.my_player = this.my_loader.content;
this.my_player.addEventListener("onReady", this.onPlayerReady);
return;
}// end function
public function onPlayerReady(param1:Event) : void
{
this.my_player.x = 30;
this.my_player.setSize(640, 360);
this.my_player.cueVideoById("xEPBcJtd11A", 0, "small");
return;
}// end function
public function playVid(param1:MouseEvent) : void
{
this.my_player.playVideo();
return;
}// end function
public function pauseVid(param1:MouseEvent) : void
{
this.my_player.pauseVideo();
return;
}// end function
function __setProp_pause_btn_Scene1_Layer1_0()
{
try
{
this.pause_btn["componentInspectorSetting"] = true;
}// end try
catch (e:Error)
{
}// end catch
this.pause_btn.emphasized = false;
this.pause_btn.enabled = true;
this.pause_btn.label = "Pausa";
this.pause_btn.labelPlacement = "right";
this.pause_btn.selected = false;
this.pause_btn.toggle = false;
this.pause_btn.visible = true;
try
{
this.pause_btn["componentInspectorSetting"] = false;
}// end try
catch (e:Error)
{
}// end catch
return;
}// end function
function __setProp_play_btn_Scene1_Layer1_0()
{
try
{
this.play_btn["componentInspectorSetting"] = true;
}// end try
catch (e:Error)
{
}// end catch
this.play_btn.emphasized = false;
this.play_btn.enabled = true;
this.play_btn.label = "Play";
this.play_btn.labelPlacement = "right";
this.play_btn.selected = false;
this.play_btn.toggle = false;
this.play_btn.visible = true;
try
{
this.play_btn["componentInspectorSetting"] = false;
}// end try
catch (e:Error)
{
}// end catch
return;
}// end function
function frame1()
{
Security.allowDomain("www.youtube.com");
this.my_loader = new Loader();
this.my_loader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3"));
this.my_loader.contentLoaderInfo.addEventListener(Event.INIT, this.onLoaderInit);
this.play_btn.addEventListener(MouseEvent.CLICK, this.playVid);
this.pause_btn.addEventListener(MouseEvent.CLICK, this.pauseVid);
return;
}// end function
}
}
那么,你会如何做同样的事情但传递一个php变量作为视频id而不是this.my_player.cueVideoById(" xEPBcJtd11A ",0,&#34 ;小&#34);直接?
谢谢!!!