来源:
http://livedocs.adobe.com/flex/3_cn/langref/mx/containers/TitleWindow.html
代码:
<?xml version="1.0" encoding="utf-8"?> <!-- Simple custom MXML TitleWindow component. The TitleWindowApp application displays this component. You cannot run it independently. --> <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" title="Title Window" x="168" y="86"> <mx:Script> <![CDATA[ import mx.managers.PopUpManager; import mx.controls.Text; // A reference to the TextInput control in which to put the result. public var loginName:Text; // Event handler for the OK button. private function returnName():void { loginName.text="Name entered: " + userName.text; PopUpManager.removePopUp(this); } ]]> </mx:Script> <mx:HBox> <mx:Label text="Enter Name: "/> <mx:TextInput id="userName" width="100%"/> </mx:HBox> <mx:HBox> <mx:Button label="OK" click="returnName();"/> <mx:Button label="Cancel" click="PopUpManager.removePopUp(this);"/> </mx:HBox> </mx:TitleWindow>
<?xml version="1.0" encoding="utf-8"?> <!-- Main application to demonstrate TitleWindow layout container. --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> <![CDATA[ import mx.managers.PopUpManager; import mx.containers.TitleWindow; import flash.geom.Point; private var point1:Point = new Point(); // Open the TitleWindow container. // Cast the return value of the createPopUp() method // to SimpleTitleWindowExample, the name of the // component containing the TitleWindow container. private function showWindow():void { var login:SimpleTitleWindowExample=SimpleTitleWindowExample(PopUpManager.createPopUp( this, SimpleTitleWindowExample , true)); // Calculate position of TitleWindow in Application's coordinates. // Position it 25 pixels down and to the right of the Button control. point1.x=0; point1.y=0; point1=myButton.localToGlobal(point1); login.x=point1.x+25; login.y=point1.y+25; // Pass a reference to the TextInput control // to the TitleWindow container so that the // TitleWindow container can return data to the main application. login.loginName=returnedName; } ]]> </mx:Script> <mx:Panel title="TitleWindow Container Example" height="75%" width="75%" paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10"> <mx:Button id="myButton" label="Click to open the TitleWindow container" click="showWindow();"/> <mx:Text id="returnedName" text="" width="100%"/> </mx:Panel> </mx:Application>
相关推荐
4. 弹出对话框:学习如何使用模态和非模态对话框,进行用户交互。 五、深入学习 随着对Flex的深入,你可以进一步研究以下主题: 1. Flex框架:了解Flex的模块化结构,如 Cairngorm、PureMVC等设计模式。 2. BlazeDS...
- Alert可以生成类似于JavaScript的alert提示框或confirm对话框,并且可以自定义弹出框的标题。 5. **AdvancedDataGrid组件:** - 用于绑定数据的属性是`dataProvider`。 - 可以以平面或树形结构显示数据。 - ...
- **弹出窗口**:使用`PopupManager`类可以创建弹出窗口。 - **TitleWindow组件**:一个带有标题栏的窗口,可以移动和关闭。 - **ViewStack组件**:用于实现多个视图之间的切换。 - **表单Form**:提供了一种结构化...
这可以通过显示错误消息、改变按钮状态或使用弹出对话框实现。在 `login.as` 中应包含处理这种情况的代码。 10. **Security Considerations**:在实际项目中,必须注意安全问题,如密码加密、防止 SQL 注入和跨站...
- Flex提供了`PopupManager`类,可以轻松创建弹出窗口或对话框,增强用户交互体验。 #### 7. **TitleWindow组件** - `TitleWindow`组件是一个带有标题栏的小型窗口,非常适合用作浮动的工具提示或小对话框。 ###...
- Flex中的弹出窗口可以通过`PopupManager`类来创建和管理。 **9. TitleWindow组件** - **TitleWindow**是一个带有标题栏的窗口,常用于对话框和提示窗口。 **10. ViewStack组件** - **ViewStack**用于切换不同...
- **控件**:包括按钮、文本框、滑块、弹出菜单、复选框等,它们是用户与GUI交互的主要元素。 - **回调函数**:当用户与控件交互时,会触发相应的回调函数,这些函数是GUI的核心,负责处理用户的输入并更新界面。 ...