Adobe Flash Builder (flex4):addChild() 在此类中不可用。
我想将 swf 加载到 flex 4 应用程序中以便使用它的类。
var ldr:Loader=new Loader();
ldr.load(new URLRequest("file://path/to/fileswf"));
ldr.contentLoaderInfo.addEventListener(Event.INIT, loaded);
function loaded(evt:Event):void { addChild(ldr); }
我收到错误:
错误:addChild() 在此类中不可用。相反,请使用 addElement() 或修改外观(如果有)。
在spark.components.supportClasses::SkinnableComponent/addChild()[E:\dev\gumbo_beta2\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:966]
在 main/private:init/loaded()[C:\Documents and Settings\ufk\Adobe Flash Builder Beta 2\xpogames-toolkit-test\src\main.mxml:22]
如果我更改 addChild()< /code> 到
addElement()
,我收到以下编译错误:
1067:将 flash.display:Loader 类型的值隐式强制转换为不相关的类型 mx.core:IVisualElement。 main.mxml 路径/目录第 22 行 Flex 问题
有什么想法可以解决此问题吗?
I want to load an swf into a flex 4 application in order to use its classes.
var ldr:Loader=new Loader();
ldr.load(new URLRequest("file://path/to/fileswf"));
ldr.contentLoaderInfo.addEventListener(Event.INIT, loaded);
function loaded(evt:Event):void { addChild(ldr); }
I receive the error:
Error: addChild() is not available in this class. Instead, use addElement() or modify the skin, if you have one.
at spark.components.supportClasses::SkinnableComponent/addChild()[E:\dev\gumbo_beta2\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:966]
at main/private:init/loaded()[C:\Documents and Settings\ufk\Adobe Flash Builder Beta 2\xpogames-toolkit-test\src\main.mxml:22]
If I change addChild()
to addElement()
, I receive the following compilation error:
1067: Implicit coercion of a value of type flash.display:Loader to an unrelated type mx.core:IVisualElement. main.mxml path/dir line 22 Flex Problem
Any ideas how to resolve this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
创建另一个容器来放置 displayObject:
Create another container to place the displayObject in:
在flash builder 4完整版中,没有任何this.rawChildren。
解决该问题的最佳方法是将每个所需的类转换为 Flex 组件并在您的 Flex 应用程序中使用它:
下载并安装 Flex 组件套件
http://www.adobe.com/cfusion/entitlement/index.html cfm?e=flex_skins
创建影片剪辑
转换为 Flex 组件
将相关函数添加到此类< /p>
该类是附加到即将转换为 Flex 组件的影片剪辑的类的骨架:
well in flash builder 4 full version, there isn't any this.rawChildren.
The best approach to resolve the issue would be to convert each required class to a flex component and to use it on your flex application:
download and install flex component kit
http://www.adobe.com/cfusion/entitlement/index.cfm?e=flex_skins
create a movie clip
convert to flex component
add the relevant functions to this class
a skeleton for a class that is attached to a movieclip that is about to be converted to a flex component:
this.rawChildren.addChild( ldr )
应该有效
this.rawChildren.addChild( ldr )
should work
试试这个。会起作用的
Try this. It will work