AS3 AIR - NativeWindow 弹出框

发布于 2024-12-02 07:57:49 字数 191 浏览 1 评论 0原文

在我的 AIR 应用程序中,当用户创建新项目时,我希望出现一个弹出框,他们可以在其中输入项目名称。我了解如何通过制作自己类型的弹出框来实现这一点,但是有吗有没有办法使用 NativeWindows 来做到这一点?也就是说,我可以使用系统镶边显示一个包含文本字段和按钮的窗口吗?

我在 FlashDevelop 中使用 Flex 4 和 AIR 2.7。

In my AIR application, when a user creates a new project I want a pop-up box to appear where they can enter their project's name in. I understand how this is doable by making my own type of pop-up box, but is there a way to do this using NativeWindows? That is, can I make a window using the system chrome appear which contains a text field and a button?

I'm using Flex 4 and AIR 2.7 in FlashDevelop.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

罪#恶を代价 2024-12-09 07:57:49

是的,你可以。创建新的 NativeWindow 时,您可以向其舞台添加和删除子级。因此,您可以将类/组件添加到新窗口并监听它们的事件。

// create NativeWindowInitOptions
var windowInitOptions:NativeWindowInitOptions = new NativeWindowInitOptions();
windowInitOptions.type = NativeWindowType.NORMAL;
windowInitOptions.minimizable = true;
windowInitOptions.resizable = false;
windowInitOptions.maximizable = false;
windowInitOptions.systemChrome = NativeWindowSystemChrome.STANDARD;
windowInitOptions.transparent = false;

// create new NativeWindow
var newWindow:NativeWindow = new NativeWindow(windowInitOptions);

// create your class
var popupBox:Sprite = new Sprite();

// resize
newWindow.width = popupBox.width;
newWindow.height = popupBox.height;

// add
newWindow.stage.addChild(popupBox);

// configure
popupBox.addEventListener(YourCustomEvent.CONFIRM, onPopupConfirm);

// for a popup it might be nice to have it activated and on top
newWindow.alwaysInFront = true;
newWindow.activate();

在 onPopupConfirm 函数中,您可以关闭窗口并清理引用。 (NativeWindow 上的 Event.CLOSING,可以方便地捕获 alt+F4 关闭等)

Yes you can. When creating a new NativeWindow you can add and remove children to its stage. So you could add your class / components to the new window and listen to their events.

// create NativeWindowInitOptions
var windowInitOptions:NativeWindowInitOptions = new NativeWindowInitOptions();
windowInitOptions.type = NativeWindowType.NORMAL;
windowInitOptions.minimizable = true;
windowInitOptions.resizable = false;
windowInitOptions.maximizable = false;
windowInitOptions.systemChrome = NativeWindowSystemChrome.STANDARD;
windowInitOptions.transparent = false;

// create new NativeWindow
var newWindow:NativeWindow = new NativeWindow(windowInitOptions);

// create your class
var popupBox:Sprite = new Sprite();

// resize
newWindow.width = popupBox.width;
newWindow.height = popupBox.height;

// add
newWindow.stage.addChild(popupBox);

// configure
popupBox.addEventListener(YourCustomEvent.CONFIRM, onPopupConfirm);

// for a popup it might be nice to have it activated and on top
newWindow.alwaysInFront = true;
newWindow.activate();

Within the onPopupConfirm function you can close the Window and cleanup references. (Event.CLOSING on the NativeWindow, could come in handy for catching alt+F4 closing and such)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文