Flex中如何设定VideoDisplay控件背景颜色(background color)的例子
By Minidxer | April 19, 2008
在前面的Flex的VideoDisplay基本使用方法的例子中,我们了解了VideoDisplay控件的播放,暂停,停止等的一些基本用法。接下来的例子演示了如何通过设定backgroundColor风格,来实现修改VideoDisplay控件的背景颜色。
让我们先来看一下Demo(可以右键View Source或点击这里察看源代码)
下面是完整代码(或点击这里察看):
Download: main.mxml
- <?xml version="1.0" encoding="utf-8"?>
- <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
- layout="vertical"
- verticalAlign="middle"
- backgroundColor="white">
- <mx:Script>
- <![CDATA[
- private function loadButton_click(evt:MouseEvent):void {
- var url:String = "http://blog.minidx.com/ext/getting-started-with-the-videodisplay-control/clouds.flv";
- videoDisplay.source = url;
- }
- private function unloadButton_click(evt:MouseEvent):void {
- videoDisplay.close();
- videoDisplay.source = null;
- videoDisplay.mx_internal::videoPlayer.clear();
- }
- ]]>
- </mx:Script>
- <mx:ApplicationControlBar dock="true">
- <mx:Form styleName="plain">
- <mx:FormItem label="backgroundColor:">
- <mx:ColorPicker id="colorPicker" />
- </mx:FormItem>
- </mx:Form>
- </mx:ApplicationControlBar>
- <mx:VideoDisplay id="videoDisplay"
- backgroundColor="{colorPicker.selectedColor}"
- width="160"
- height="120" />
- <mx:ControlBar>
- <mx:Button id="loadButton"
- label="Load"
- click="loadButton_click(event);" />
- <mx:Button id="unloadButton"
- label="Unload"
- click="unloadButton_click(event);" />
- </mx:ControlBar>
- </mx:Application>
代码:Peter deHaan 翻译/整理/编译:minidxer
Topics:
Flex |
Tags: backgroundColor, Flex, VideoDisplay, 背景颜色
Trackbacks