Flex 3:以编程方式将 MovieClip 符号嵌入到图像控件

发布于 2024-08-09 03:49:01 字数 615 浏览 7 评论 0原文

我已经查看了与此相关的所有文档和 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 技术交流群。

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

发布评论

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

评论(1

只等公子 2024-08-16 03:49:01

您应该能够简单地将 child.source 设置为 StarClass:

        child = new Image();
        child.source = StarClass;

请参阅 MovieClipAsset 语言参考了解更多详细信息:

您很少需要自己创建 MovieClipAsset 实例
因为图像相关的属性和
样式可以设置为
图像生成类和组件
将根据需要创建实例。
例如,设置应用程序
这个动画的背景,你可以
只需编写以下内容:

 ;

You should be able to simply set child.source to StarClass:

        child = new Image();
        child.source = StarClass;

See the MovieClipAsset Language Reference for more details:

you rarely need to create MovieClipAsset instances yourself
because image-related properties and
styles can be set to an
image-producing class, and components
will create instances as necessary.
For example, to set the application
background to this animation, you can
simply write the following:

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