0

初めて Flex に遭遇した PHP ジュニアとして、これは何日もの間私の頭を悩ませました。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 を呼び出そうとしましたが、機能しません。FlashVars にアクセスするには、mxml のソースで何を適用する必要があるか教えてください。

<s:VideoPlayer id="Player" left="0" top="0" width="497" height="414"
                       skinClass="MySkin" source="FlashVars"/>
    </s:Group>
4

2 に答える 2

1
<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>
于 2011-07-26T17:55:34.463 に答える
1

変数には何がvideoSource含まれていますか? flashvars は、(値だけでなく) 変数名と値を含む文字列であると想定されているため、ビデオへの URL であり、それ以上のものではない場合、おそらく機能しません。

たとえば、ビデオ プレーヤーが という名前の変数を使用するように作成されている場合、 は機能しflashvars="video.flv"ませんが、機能する可能性があります。flashvars="sourceUrl=video.flv"sourceUrl

また、要素の属性として flashvars を使用する代わりに、flashvars 用にobject別の要素を追加する必要があります。要素の場合、flashvars は現在の属性です (標準ではありません ;)paramobjectembed

より詳しい情報:

http://kb2.adobe.com/cps/164/tn_16417.html

于 2011-07-26T18:23:02.670 に答える