<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" height="600" width="600">
    
<mx:Script>
        
<![CDATA[
            
import mx.containers.TitleWindow;
            
import flash.events.*;
            
import mx.managers.PopUpManager;
            
import mx.controls.Button;
            
import mx.core.IFlexDisplayObject;
            
            
// The variable for the TitleWindow container
            public var myTitleWindow:TitleWindow = new TitleWindow();

            
// Method to instantiate and display a TitleWindow container.
            
// This is the initial Button control's click event handler.
            public function openWindow(event:MouseEvent):void {
                
// Set the TitleWindow container properties.
                myTitleWindow = new TitleWindow();
                myTitleWindow.showCloseButton
=true;
               
                myTitleWindow.title 
= "My Window Title";
                myTitleWindow.width
= 220;
                myTitleWindow.height
= 150;
                
                
// Call the method to add the Button control to the 
                
// TitleWindow container.
                populateWindow();
                
// Use the PopUpManager to display the TitleWindow container.
                PopUpManager.addPopUp(myTitleWindow, thistrue);
            }

        
            
// The method to create and add the Button child control to the
            
// TitleWindow container.
            public function populateWindow():void {
                var btn1:Button 
= new Button();
                btn1.label
="close";
                btn1.addEventListener(MouseEvent.CLICK, closeTitleWindow);
                myTitleWindow.addChild(btn1);    
            }

            
// The method to close the TitleWindow container.
            public function closeTitleWindow(event:MouseEvent):void {
                PopUpManager.removePopUp(event.currentTarget.parent);
                
            
private function removeForm():void {
                PopUpManager.removePopUp(helpWindow);

            }

        ]]
>
    
</mx:Script>
    
<mx:Button label="Open Window" click="openWindow(event)"/>
</mx:Application>

先把代码贴出来,其实是FLEX的帮助文档,但是如何显示一个简单窗体在网上找半天没找到,又不知道该如何使用FLEX的帮助,呵呵.今天在kenshin的提醒下找到了这个,myTitleWindow.showCloseButton=true;这个属性是我自己加的,实现了在简单窗体上的关闭按钮,但还不知道如何处理其事件,下次再说吧,先实现这个再说
posted on 2006-08-08 15:36  forrestsun  阅读(1037)  评论(0编辑  收藏  举报