Flex中如何设定VideoDisplay控件背景颜色(background color)的例子

在前面的 Flex的VideoDisplay基本使用方法的例子中,我们了解了VideoDisplay控件的播放,暂停,停止等的一些基本用法。接下来的例子演示了如何通过设定 backgroundColor风格,来实现修改VideoDisplay控件的背景颜色。
让我们先来看一下Demo(可以右键View Source或 点击这里察看源代码
Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
  3.         layout="vertical"
  4.         verticalAlign="middle"
  5.         backgroundColor="white">
  6.     <mx:Script>
  7.         <![CDATA[
  8.             private function loadButton_click(evt:MouseEvent):void {
  9.                 var url:String = "http://blog.minidx.com/ext/getting-started-with-the-videodisplay-control/clouds.flv";
  10.                 videoDisplay.source = url;
  11.             }
  12.             private function unloadButton_click(evt:MouseEvent):void {
  13.                 videoDisplay.close();
  14.                 videoDisplay.source = null;
  15.                 videoDisplay.mx_internal::videoPlayer.clear();
  16.             }
  17.         ]]>
  18.     </mx:Script>
  19.     <mx:ApplicationControlBar dock="true">
  20.         <mx:Form styleName="plain">
  21.             <mx:FormItem label="backgroundColor:">
  22.                 <mx:ColorPicker id="colorPicker" />
  23.             </mx:FormItem>
  24.         </mx:Form>
  25.     </mx:ApplicationControlBar>
  26.     <mx:VideoDisplay id="videoDisplay"
  27.             backgroundColor="{colorPicker.selectedColor}"
  28.             width="160"
  29.             height="120" />
  30.     <mx:ControlBar>
  31.         <mx:Button id="loadButton"
  32.                 label="Load"
  33.                 click="loadButton_click(event);" />
  34.         <mx:Button id="unloadButton"
  35.                 label="Unload"
  36.                 click="unloadButton_click(event);" />
  37.     </mx:ControlBar>
  38. </mx:Application>

你可能感兴趣的:(职场,休闲,color)的例子)