Flex中如何调用Flash FLVPlayback控件的例子

By Minidxer | June 3, 2009

接下来的例子演示了Flex中如何调用Flash FLVPlayback控件。

实际上很简单,将FLVPlaybackAS3.swc复制到Flex项目的/libs/下面,就可以使用了。
如果是Flash CS3:
PC: \Adobe Flash CS3\en\Configuration\Components\Video\FLVPlaybackAS3.swc
如果是Flash CS4:
PC: \Adobe Flash CS4\Common\Configuration\Components\Video\FLVPlaybackAS3.swc



下面是使用代码:

Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application name="FLVPlayback_MXML_test"
  3.         xmlns:mx="http://www.adobe.com/2006/mxml"
  4.         xmlns:video="fl.video.*"
  5.         layout="vertical"
  6.         verticalAlign="middle"
  7.         backgroundColor="white">
  8.  
  9.     <mx:Script>
  10.         <![CDATA[
  11.             private function flvPlayback_autoLayout(evt:Event):void {
  12.                 videoHolder.width = flvPlayback.width;
  13.                 videoHolder.height = flvPlayback.height;
  14.                 flvPlayback.x = 0;
  15.                 flvPlayback.y = 0;
  16.             }
  17.         ]]>
  18.     </mx:Script>
  19.  
  20.     <video:FLVPlayback id="flvPlayback"
  21.             source="http://www.helpexamples.com/flash/video/caption_video.flv"
  22.             scaleMode="maintainAspectRatio"
  23.             skin="SkinOverPlaySeekMute.swf"
  24.             skinAutoHide="true"
  25.             autoLayout="flvPlayback_autoLayout(event);" />
  26.  
  27.     <mx:ApplicationControlBar dock="true">
  28.         <mx:Button id="btn"
  29.                 label="Play Video"
  30.                 click="videoHolder.addChild(flvPlayback);" />
  31.     </mx:ApplicationControlBar>
  32.  
  33.     <mx:Panel backgroundColor="red">
  34.         <mx:UIComponent id="videoHolder" />
  35.     </mx:Panel>
  36.  
  37. </mx:Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子

Topics: Other | No Comments » | 730 views Tags: , ,

你可能还对下列文章感兴趣:

Leave a Comment

Name(*):

E-Mail(*) :

Website :

Comments :

Search Posts