为导入的 SWC 元素创建类
我已将 SWC 导入到我的 Actionscript 项目中。它包含许多不同的影片剪辑,我可以在我的项目中访问它们。我的问题是:如何创建一个自定义 AS3 类,用于向我的影片剪辑添加函数和属性?
例如,我有一个链接名称为 LevelButton 的影片剪辑。我尝试创建一个同名的类,但它们似乎并不在一起。
谢谢,
I have imported a SWC into my actionscript project. It includes many different movieclips that I can access in my project. My question is this: How can I create a custom AS3 class that I can use to add functions and properties to my movieclips?
For example I have a movieclip with a linkage name of LevelButton. I tried creating a class that was the same name but they didn't seem to go together.
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须在生成 SWC 之前创建该类,然后它将被编译到其中。如果您不提供类,Flash 将使用它自己的空类。
之后你就不能这样做......
然后你可以说:
you have to create the class before you generate the SWC and then it'll get compiled into the it. if you don't supply a class, Flash will use an empty class of its own.
you can't do this afterwards ...
and then you can just say:
我能够通过在我的影片剪辑上生成具有正确链接名称的 .SWC 来实现此目的。然后在我的应用程序中我创建了一个扩展影片剪辑的类。
IE。带有链接名称的影片剪辑:
MyMovieclip_mc
然后是我的应用程序类:
I was able to accomplish this by generating the .SWC with proper linkage names on my movieclip. Then in my application I created a class that extending the movieclip.
ie. Movieclip with linkage name:
MyMovieclip_mc
then my application class: