WindowApplication 嵌套在应用程序中?弹性4
我正在制作一个桌面应用程序,并且正在探索使用应用程序的不同方式。
当我选择创建一个air应用程序时,它会自动使用WindowApplication,但如果我想在我的应用程序中使用多个窗口,那么我需要使用Application。我试图将 WindowApplication 嵌套在 Application 中,这样我就可以拥有多个窗口(通过 Application -> new Window()) 并在后台有一个无边框、透明的程序。当我嵌套WindowApplication时,它可以工作,但是当我单击WindowApplication(运行调试后)时,它会抛出错误:“参数错误:错误#2025:提供的DisplayObject 必须是调用者的子级”。
这是我使用的一些代码。我正在使用 Air 2.5 和 Flash Builder 4。(xml 文件是默认的)。
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
applicationComplete="main()">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import spark.components.Label;
import spark.components.Window;
private var windows:Array = new Array();
private function main():void
{
var window:Window;
var numOfWindows:Number = 2;
for(var i:Number=0; i<numOfWindows;i++)
{
window = new Window();
window.width = 300;
window.title = "I am Window #"+i;
window.height = 200;
window.open(true);
window.showStatusBar = false;
windows.push(window);
}
trace("Complete!");
}
]]>
</fx:Script>
<s:WindowedApplication >
<!-- Compiles, but once I click this, it throws the error. -->
</s:WindowedApplication>
</s:Application>
我怎样才能有一个可以控制几个窗口的透明应用程序(或者至少摆脱上面的错误)? 提前致谢。
I am making a desktop application and I am exploring different ways to use application.
When I choose to make an air app it automatically uses WindowApplication but if I want multiple windows in my application, then I need to use Application instead. I was trying to nest WindowApplication inside Application so I can have multiple windows (by Application -> new Window()) and have a chromeless, transparent program in the background. When I nest WindowApplication it works but when I click the WindowApplication (after running debug) it would throw an error: "Argument Error: Error #2025: The supplied DisplayObject must be a child of the caller".
Here is some code I used. I am using Air 2.5 with Flash Builder 4. (the xml file is default).
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
applicationComplete="main()">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import spark.components.Label;
import spark.components.Window;
private var windows:Array = new Array();
private function main():void
{
var window:Window;
var numOfWindows:Number = 2;
for(var i:Number=0; i<numOfWindows;i++)
{
window = new Window();
window.width = 300;
window.title = "I am Window #"+i;
window.height = 200;
window.open(true);
window.showStatusBar = false;
windows.push(window);
}
trace("Complete!");
}
]]>
</fx:Script>
<s:WindowedApplication >
<!-- Compiles, but once I click this, it throws the error. -->
</s:WindowedApplication>
</s:Application>
How could I have a transparent application that can control a few windows (or at least get rid of the error above)?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
WindowedApplication 不打算用作子元素,它是顶级元素。您应该使用 Application 或 WindowedApplication 作为根元素,并且切勿尝试将它们嵌套在一起。更多信息请参见官方语言参考:http:// /help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/core/WindowedApplication.html
WindowedApplication is not intended to be used as a child element, it is a top level element. You should use Application or WindowedApplication as your root element, and never try to nest them inside each other. More information in the official language reference: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/core/WindowedApplication.html