Add button to window through ActionScript : TitleWindow « Container « Flex

Home
Flex
1.Chart
2.Components
3.Container
4.Data Model
5.Development
6.Effects
7.Event
8.Graphics
9.Grid
10.Style
Flex » Container » TitleWindow 




Add button to window through ActionScript
Add button to window through ActionScript
            
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" height="600"
    width="600">
    <mx:Script>
        
        import mx.containers.TitleWindow;
        import flash.events.*;
        import mx.managers.PopUpManager;
        import mx.controls.Button;
        import mx.core.IFlexDisplayObject;
        public var myTitleWindow:TitleWindow = new TitleWindow();
        
        public function openWindow(event:MouseEvent):void {
            myTitleWindow = new TitleWindow();
            myTitleWindow.title = "Window Title";
            myTitleWindow.width= 220;
            myTitleWindow.height= 150;

            var btn1:Button = new Button();
            btn1.label="close";
            btn1.addEventListener(MouseEvent.CLICK, closeTitleWindow);
            myTitleWindow.addChild(btn1);

            PopUpManager.addPopUp(myTitleWindow, this, true);
        }
        public function closeTitleWindow(event:MouseEvent):void {
            PopUpManager.removePopUp(event.currentTarget.parent);
        }
      
    </mx:Script>
    <mx:Button label="Open Window" click="openWindow(event);" />
</mx:Application>

   
    
    
    
    
    
    
    
    
    
    
    
  














Related examples in the same category
1.Add close event listener for TitleWindowAdd close event listener for TitleWindow
2.Add Mouse Down listener to TitleWindowAdd Mouse Down listener to TitleWindow
3.Adding mouse event to Panel and TitleWindowAdding mouse event to Panel and TitleWindow
4.Creates a TitleWindow container inside a Panel container.Creates a TitleWindow container inside a Panel container.
5.Resize TitleWindow with TransitionResize TitleWindow with Transition
6.Change TitleWindow position and size in stateChange TitleWindow position and size in state
7.Add control to TitleWindowAdd control to TitleWindow
8.Make TitleWindow to show Close buttonMake TitleWindow to show Close button
9.Add close handler to TitleWindowAdd close handler to TitleWindow
10.Top level TitleWindow tag
11.TitleWindow Title, close button, position, border color and border alphaTitleWindow Title, close button, position, border color and border alpha
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.