Flex中如何利用maintainAspectRatio属性使VideoDisplay保持载入时比例的例子

By Minidxer | June 15, 2009

接下来的例子演示了Flex中如何利用maintainAspectRatio属性,使VideoDisplay保持载入时比例。

让我们先来看一下Demo可以点击这里察看源代码):


下面是完整代码(或点击这里察看):

Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application name="VideoDisplay_maintainAspectRatio_test"
  3.         xmlns:mx="http://www.adobe.com/2006/mxml"
  4.         layout="vertical"
  5.         verticalAlign="middle"
  6.         backgroundColor="white">
  7.  
  8.     <mx:ApplicationControlBar dock="true">
  9.         <mx:Form styleName="plain">
  10.             <mx:FormItem label="maintainAspectRatio:">
  11.                 <mx:CheckBox id="checkBox" />
  12.             </mx:FormItem>
  13.         </mx:Form>
  14.     </mx:ApplicationControlBar>
  15.  
  16.     <mx:VideoDisplay id="videoDisplay"
  17.             maintainAspectRatio="{checkBox.selected}"
  18.             source="http://helpexamples.com/flash/video/cuepoints.flv"
  19.             autoPlay="false"
  20.             width="200"
  21.             height="200"
  22.             click="videoDisplay.play();" />
  23.  
  24. </mx:Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子

Topics: VideoDisplay | No Comments » | Tags: ,

Search Posts