Flex中利用PopUpManager和TitleWindow类创建自定义对话框的例子(实用)
By Minidxer | July 28, 2008
和前面Flex中利用PopUpManager和TitleWindow类创建自定义对话框的例子一样,接下来的例子演示了Flex中利用PopUpManager和TitleWindow类,创建自定义对话框。不过本例包含了CheckBox选择框,可以选中点击“Continue”进入下一个画面。
让我们先来看一下Demo(可以右键View Source或点击这里察看源代码):
下面是完整实现代码(或点击这里察看):
Download: main.mxml
- <?xml version="1.0" encoding="utf-8"?>
- <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
- title="Installing Super Awesome Component Set for Flex 3"
- layout="vertical"
- width="480"
- height="240"
- titleStyleName="titleText"
- backgroundColor="white"
- backgroundAlpha="1.0"
- borderColor="white"
- borderAlpha="1.0"
- cornerRadius="0"
- dropShadowEnabled="false"
- showCloseButton="true"
- close="titleWindow_close(event)">
- <mx:Script>
- <![CDATA[
- import mx.controls.Alert;
- import mx.events.CloseEvent;
- import mx.managers.PopUpManager;
- private function titleWindow_close(evt:CloseEvent):void {
- PopUpManager.removePopUp(this)
- }
- private function titleWindow_continue():void {
- Alert.show("Installing...");
- PopUpManager.removePopUp(this);
- }
- ]]>
- </mx:Script>
- <mx:Style>
- .titleText {
- fontSize: 14px;
- }
- .headingText {
- paddingTop: 10px;
- paddingBottom: 10px;
- fontSize: 10px;
- }
- </mx:Style>
- <mx:Text text="You must accept the software license terms in order to continue the installation."
- width="100%"
- styleName="headingText" />
- <mx:TextArea text="The quick brown fox jumped over the lazy dog"
- width="100%"
- height="100%" />
- <mx:HBox width="100%">
- <mx:CheckBox id="checkBox"
- label="Click here to accept the software license terms."
- width="100%" />
- <mx:Button label="Continue"
- enabled="{checkBox.selected}"
- click="titleWindow_continue()" />
- </mx:HBox>
- </mx:TitleWindow>
代码:Peter deHaan 翻译/整理/编译:minidxer
Topics:
Flex |
Tags: addPopUp, centerPopUp, CloseEvent, createPopUp, PopUpManager, removePopUp, TitleWindow, 对话框