2011-07-26 3 views
0

フレックスに初めて出会った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> 

答えて

1

変数videoSourceは何が含まれていますか? flashvarsは変数名と値(単なる値ではありません)を含む文字列であるはずですので、それがビデオのURLであり、それ以上のものでない場合、おそらく動作しません。

たとえば、ビデオプレーヤーでsourceUrlという名前の変数を使用すると、flashvars="video.flv"は機能しませんが、flashvars="sourceUrl=video.flv"は機能します。

また、object要素の場合、object要素の属性としてflashvarsを使用する代わりに、別のparam要素をフラッシュバーに追加する必要があります。 (AINT基準素晴らしい;)あなたは今それを持っているようembed要素については、FlashVarsのは、属性である

さらに詳しい情報:

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

+0

コードでparam要素をどのように探すべきか() – George

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> 
+0

と他のすべては、右ですか?私はこの機能を追加して、プレーヤーを正しく動作させる必要がありますか? – George

+0

番号。この関数を追加すると、flashVarが変数に追加されます。あなたは残りの部分を見つけなければなりません。 –

関連する問題