Flex 3:以编程方式将 MovieClip 符号嵌入到图像控件
我已经查看了与此相关的所有文档和 Google 结果,并且我认为我的所有设置都正确。我的问题是该符号没有出现在我的应用程序中。我有一个已嵌入到 Flex 组件中的 MovieClip 元件。我需要为 dataProvider 中的每个项目创建一个新的图像控件,并将此嵌入符号指定为图像的源。我以为这很简单,但显然不是。这是代码的存根:
[Embed(source="../assets/assetLib.swf", symbol="StarMC")]
private var StarClass:Class;
protected function rebuildChildren():void {
iterator.seek( CursorBookmark.FIRST );
while ( !iterator.afterLast ) {
child = new Image();
var asset:MovieClipAsset = new StarClass() as MovieClipAsset;
(child as Image).source = asset;
}
}
我知道孩子正在被创建,因为我可以绘制一个形状,然后它就会出现。我做错了什么吗?谢谢你!
I've reviewed all the documentation and Google results surrounding this and I think I have everything setup correctly. My problem is that the symbol is not appearing in my app. I have a MovieClip symbol that I've embedded to my Flex Component. I need to create a new Image control for each item from my dataProvider and assign this embedded symbol as the Image's source. I thought it was simple but apparently not. Here's a stub of the code:
[Embed(source="../assets/assetLib.swf", symbol="StarMC")]
private var StarClass:Class;
protected function rebuildChildren():void {
iterator.seek( CursorBookmark.FIRST );
while ( !iterator.afterLast ) {
child = new Image();
var asset:MovieClipAsset = new StarClass() as MovieClipAsset;
(child as Image).source = asset;
}
}
I know the child is being created because I can draw a shape and and that appears. Am I doing something wrong? Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该能够简单地将 child.source 设置为 StarClass:
请参阅 MovieClipAsset 语言参考了解更多详细信息:
You should be able to simply set child.source to StarClass:
See the MovieClipAsset Language Reference for more details: