owned windows in air 2.6

One of the new desktop features in AIR 2.6 is owned windows. Owned windows are primarily designed for when you want a utility or a lightweight window to be related to another window as in the case of a tool pallet. The following describes the relationship between owned windows and their owners:

owned Windows  是在AIR2.6中的一个新的桌面桌面应用特性。Owned windows 是一个主要用于当你想要设计一个关联其它实用工具窗口或者是轻量级窗口的窗口。下面的描述描述了owned windows和他们的拥有者的关系。

  • Owned windows always have a higher z-order than their owners which means they always appear on top (you wouldn’t want a tool pallet to get lost behind your application window).
  • Owned windows 总是比他们的拥有者拥有最高的Z序列,这意味着他们总是显示在顶部(你一定一定不会希望一个工具条显示在你的应用窗口后面)
  • When you minimize or hide the owner, all owned windows are minimized, as well. When you restore the owner, the owned windows are also restored.
  • 当你最小化或者隐藏拥有者的时候,所有包含的窗口将被最小化。同样当你恢复拥有窗口时,他的下属窗口也将同时被恢复。
  • When you close the owner, all owned windows also close.
  • 当你关闭拥有者的时候,所有下属窗口也被关闭。

Here’s an example of owned windows in action: 这是一个例子:

 

And here’s the code: 这里是代码

 

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx">
    <fx:Script>
        <![CDATA[
            private function openNewWindow(owned:Boolean):void
            {
                var initOptions:NativeWindowInitOptions = new NativeWindowInitOptions();
                initOptions.type = NativeWindowType.UTILITY;
                if (owned) initOptions.owner = this.nativeWindow;
                var newWin:NativeWindow = new NativeWindow(initOptions);
                newWin.title = (owned) ? "Owned Window" : "Normal Window";
                newWin.activate();
            }
        ]]>
    </fx:Script>
    <s:VGroup width="100%" height="100%" verticalAlign="middle" horizontalAlign="center">
        <s:Button label="Open Ownded Window" click="openNewWindow(true);"/>
        <s:Button label="Open Regular Window" click="openNewWindow(false);"/>
    </s:VGroup>
</s:WindowedApplication>

 

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: