2011-07-17 3 views
0

インターネットチュートリアルの中には、PHPとFlexを使用したFLVビデオプレーヤーのためのシンプルなサーバークライアントアプリケーションが用意されています。私が遭遇した問題は、メモ帳++を使用してmxmlファイルのビデオのソースを変更できないことです。 Flexを実行するとソースが変更される可能性がありますが、このプレーヤーで別の動画を再生したいので、それは良い考えではありません。私のアプリケーションはFlexPlayer.mxmlのソースでのみ動作するので、このFlex Video Playerコンポーネントを使用して別のビデオを実行する方法を提案してください。おそらく、このビデオソースのmxmlファイルを使用しないでください。ビデオプレーヤーコンポーネントで異なるビデオをフレックスロードする

<s:VideoPlayer id="Player" left="0" top="0" width="493" height="382" chromeColor="#2875DE" 
    color="#000000" skinClass="MySkin" source="Video Source/Coldplay - Clocks.flv"/>  
</s:Application> 

答えて

1

フレックスアプリがコンパイルされているため、正しいムービーを定義するために使用することはできません。

ただし、実行時に他の方法でデータをアプリケーションに取り込むことはできます。例えば

あなたはそれを毎回実行する前に、メモ帳などのテキストエディタでこれを編集することができますので、あなたは、HTMLでのパラメータでビデオファイルを指定することができます。この場合

<?xml version="1.0"?> 
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
      xmlns:s="library://ns.adobe.com/flex/spark" 
      xmlns:mx="library://ns.adobe.com/flex/mx" > 

<s:VideoPlayer id="Player" left="0" top="0" width="493" height="382" chromeColor="#2875DE" 
       color="#000000" skinClass="MySkin" source="{this.parameters.videoFile}"/>  

</s:Application> 

を、あなたはでしょうフレックスアプリをflashvarパラメータとして呼び出すhtmlで指定します。 htmlページでこれを探してください:

<script type="text/javascript"> 
     // For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. 
     var swfVersionStr = "10.2.0"; 
     // To use express install, set to playerProductInstall.swf, otherwise the empty string. 
     var xiSwfUrlStr = "playerProductInstall.swf"; 
     var flashvars = {}; 
     flashvars.videoFile = 'Video Source/Coldplay - Clocks.flv'; // specifying video here 
     var params = {}; 
     params.quality = "high"; 
     params.bgcolor = "#ffffff"; 
     params.allowscriptaccess = "sameDomain"; 
     params.allowfullscreen = "true"; 
     var attributes = {}; 
     attributes.id = "scratch"; 
     attributes.name = "scratch"; 
     attributes.align = "middle"; 
     swfobject.embedSWF(
      "scratch.swf", "flashContent", 
      "100%", "100%", 
      swfVersionStr, xiSwfUrlStr, 
      flashvars, params, attributes); 
     // JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. 
     swfobject.createCSS("#flashContent", "display:block;text-align:left;"); 
    </script> 

意味がありますか?

関連する問題