作为一名PHP新手,这是我第一次接触Flex,这让我头疼了好几天。flashvar包含我想要在Flex视频组件中播放的视频源。播放器的HTML如下所示:
function createPlayer(videoSource){
document.writeln("<div id=\"player\">");
document.writeln("<object width=\"489\" height=\"414\" FlashVars=\""+videoSource+"\">");
document.writeln("<param name=\"player\" value=\"bin-debug/FlexPlayer.swf\">");
document.writeln("<embed src=\"bin-debug/FlexPlayer.swf\" name=\"player\" width=\"489\" height=\"414\" FlashVars=\""+videoSource+"\">");
document.writeln("</embed>");
document.writeln("</object>");
document.writeln("</div>");
}我试图在FlexPlayer.mxml中调用FlashVars,但它不起作用。请告诉我必须在mxml的源代码中应用什么才能访问FlashVars。
<s:VideoPlayer id="Player" left="0" top="0" width="497" height="414"
skinClass="MySkin" source="FlashVars"/>
</s:Group>发布于 2011-07-27 02:23:03
变量videoSource包含什么?如果它只是一个视频的URL,它可能不会工作,因为flashvars应该是一个包含变量名称和值(而不仅仅是值)的字符串。
例如,如果视频播放器使用名为sourceUrl的变量,flashvars="video.flv"将无法工作,但flashvars="sourceUrl=video.flv"可以工作。
此外,对于object元素,您应该为flashvars添加一个单独的param元素,而不是将flashvars作为object元素的属性。对于embed元素,flashvars是一个属性,就像您现在拥有的那样(不是很好的标准;)
更多信息:
http://kb2.adobe.com/cps/164/tn_16417.html
发布于 2011-07-27 01:55:34
<mx:Script>
<![CDATA[
private function init():void {
// The FlashVars
var obj:Object = Application.application.parameters;
var videoSource:String = (obj.videoSource != null) ? obj.videoSource : "there was no flashVar by this name";
trace(videoSource);
}
]]>
</mx:Script>https://stackoverflow.com/questions/6834277
复制相似问题