Flex - ArgumentError:错误 #2025:使用添加的 swc 文件时提供的 DisplayObject 必须是调用者的子级
我知道已经有人就这个错误 #2025 主题提出了很多问题。
但是,就我而言,当尝试在 Flex 项目中使用 .swc
文件时,就会发生这种情况。
我正在尝试通过添加“Add swc
”文件来将我的一个库项目使用到另一个 Flex 项目中。 我已成功将其作为 .swc
文件添加到我的新项目中。
但是,当我尝试通过单击浏览器中的应用程序来使用它的新项目时,它会向我显示此运行时错误。下面是我的新项目的主文件。
NewSample.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:swclib="*"
layout="absolute">
<swclib:Main width="100%" height="100%"/>
</mx:Application>
StackTrace:
ArgumentError:错误#2025:提供的 DisplayObject 必须是子对象 来电者的。在 flash.display::DisplayObjectContainer/getChildIndex() 位于 mx.managers::SystemManager/getChildIndex()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\managers\SystemManager.as:1772] 在 mx.managers::SystemManager/mouseDownHandler()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\managers\SystemManager.as:3615]
我无法确定导致错误的原因?
编辑:这是.swc
库文件的主要应用程序文件。
Main.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:parsley="http://www.spicefactory.org/parsley"
minWidth="955" minHeight="600"
xmlns:custom="components.*"
horizontalScrollPolicy="off"
layout="vertical"
verticalScrollPolicy="off" xmlns:models="models.*" xmlns:views="views.*">
<views:Header width="100%" height="50"/>
<mx:HDividedBox id="hdv" width="100%" height="100%">
<views:ABC width="15%" height="100%"/>
<views:DEF width="65%" height="100%"/>
<views:XYZ width="20%" height="100%"/>
</mx:HDividedBox>
<parsley:ContextBuilder config="Conf"/>
</mx:Application>
I know already so many questions have been asked here on this error #2025 topic.
But, in my case, it is happening when trying to use a .swc
file in a flex project.
I am trying to use one of my library project into another flex project by adding using "Add swc
" file.
I have successfully added it in my new project as a .swc
file.
But, when I try to use it new project by clicking on the application in browser, it shows me this runtime error. Below is my new project's main file.
NewSample.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:swclib="*"
layout="absolute">
<swclib:Main width="100%" height="100%"/>
</mx:Application>
StackTrace:
ArgumentError: Error #2025: The supplied DisplayObject must be a child
of the caller. at
flash.display::DisplayObjectContainer/getChildIndex() at
mx.managers::SystemManager/getChildIndex()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\managers\SystemManager.as:1772]
at
mx.managers::SystemManager/mouseDownHandler()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\managers\SystemManager.as:3615]
I am unable to identify what caused the error ?
EDIT : This is the main application file of the .swc
library file.
Main.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:parsley="http://www.spicefactory.org/parsley"
minWidth="955" minHeight="600"
xmlns:custom="components.*"
horizontalScrollPolicy="off"
layout="vertical"
verticalScrollPolicy="off" xmlns:models="models.*" xmlns:views="views.*">
<views:Header width="100%" height="50"/>
<mx:HDividedBox id="hdv" width="100%" height="100%">
<views:ABC width="15%" height="100%"/>
<views:DEF width="65%" height="100%"/>
<views:XYZ width="20%" height="100%"/>
</mx:HDividedBox>
<parsley:ContextBuilder config="Conf"/>
</mx:Application>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您真的需要
Application
吗?Application
应该只是上层和主类。可能的解决方案:
Canvas
)。我更喜欢使用第一个变体。
Do you really need
Application
?Application
should be only the upper one and main class.Possible solutions:
Canvas
).I'd prefer to use 1st variant.
我敢打赌,您不会检查(您认为的子)对象实际上是否是(您认为的父)对象的子对象,
在那里放置一个
if
,如下所示:I bet you are not checking if the (you think child) object is actually a child of the (you think parent) object
Put an
if
there like: