Specifying whether a new Window is focused in Adobe AIR
In a previous example, “Opening a new Window in Adobe AIR”, we saw how you could launch a new Flex Window container in Adobe AIR by creating a custom Window component and calling the open()
method.
The following example shows how you can control whether the newly opened window receives focus and becomes active by setting the Boolean openWindowActive
attribute to the open()
method.
<?xml version="1.0" encoding="utf-8"?> <!-- http://airexamples.com/2010/03/12/specifying-whether-a-new-window-is-focused-in-adobe-air/ --> <mx:WindowedApplication name="Window_open_openWindowActive_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"> <mx:Script> <![CDATA[ import mx.core.Window; protected function btn_clickHandler(evt:MouseEvent):void { var win:MyWin = new MyWin(); win.open(ch.selected); } ]]> </mx:Script> <mx:ApplicationControlBar dock="true"> <mx:CheckBox id="ch" label="openWindowActive:" labelPlacement="left" selected="true" /> </mx:ApplicationControlBar> <mx:Button id="btn" label="Open Window" click="btn_clickHandler(event);" /> </mx:WindowedApplication>
And the custom Window component, MyWin.mxml, is as follows:
<?xml version="1.0" encoding="utf-8"?> <!-- http://airexamples.com/2010/03/12/specifying-whether-a-new-window-is-focused-in-adobe-air/ --> <mx:Window name="MyWin" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="300" height="200"> <mx:Label id="lbl" text="I'm a Window!" fontSize="32" horizontalCenter="0" verticalCenter="0" /> </mx:Window>
- Share this:
One Response to Specifying whether a new Window is focused in Adobe AIR
Leave a Reply Cancel reply
- http://get.adobe.com/air/
- Platform ActionScript Language Reference
Recent Posts
- Detecting the number of screens on a users system in Adobe AIR
- Opening a new NativeWindow in Adobe AIR
- Detecting the line-ending character sequence used by the host operating system in Adobe AIR
- Displaying a custom title bar icon in a WindowedApplication container in Adobe AIR
- Setting a custom text style on the status bar on a WindowedApplication container in Adobe AIR
- Keeping a WindowedApplication on top of other windows in Adobe AIR
- Specifying whether a new Window is focused in Adobe AIR
- Opening a new Window in Adobe AIR
- Setting the file size display mode in the Flex FileSystemDataGrid control in Adobe AIR
- Sorting the FileSystemDataGrid control by date in Adobe AIR
Archives
- March 2010 (10)
- February 2009 (3)
- January 2009 (6)
- December 2008 (44)
hii
thanks its good example and very eagy