如何将脚本(AS3)添加到项目中?

发布于 2024-09-30 00:02:24 字数 86 浏览 1 评论 0原文

我正在使用 Adob​​e Flash CS3 和 Actionscript 3.0。除了将脚本添加到新关键帧之外,还有哪些不同的方法可以将脚本添加到项目中?

I am using Adobe Flash CS3 with Actionscript 3.0. What are the different ways to add scripts to a project except adding the script to a new keyframe?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

孤云独去闲 2024-10-07 00:02:24

正如卡梅伦建议的那样,指定文档类是一个很好的起点。然后,该类(主类,如果您愿意的话)可以导入和使用其他类。

您还可以指定库项目的类(ActionScript 的属性/链接/导出)。

Specifying a document class, as Cameron suggest, is a good starting point. That class (the main class, if you will) can then import and use other classes.

You can also specify classes for library items (Properties/Linking/Export for ActionScript).

浪菊怪哟 2024-10-07 00:02:24

您可以使用“文档类”字段为整个阶段指定一个类,或者,如果您想要某种模块化,您也可以将库符号链接到特定类。

链接属性可在库中元件的属性中找到,选中“导出为 Actionscript”复选框并填写“类”字段。

如果您想要类似于其他编程语言的“主要”功能的功能,那么文档类就是您的最佳选择。否则,将符号链接到您喜欢的类并手动将其放入舞台。

You can use the Document Class field to specify a class for the whole stage, or, if you want some modularity, you can link a library symbol to a specific class too.

The Linkage property is available in the Properties of a symbol from the library, checking the Export For Actionscript checkbox and filling the Class field.

If you want a functionality similar to the "main" function of the other programming languages, the Document Class is the way to go. Otherwise, link a symbol to the class of your liking and put it in stage manually.

南笙 2024-10-07 00:02:24

您可以使用 文档类,它允许您的脚本专门驻留在文件中(而不是驻留在框架上)。

据我所知,这是将代码链接到 Flash 创作工具中的项目的唯一其他方法。

更新:
正如其他人提到的,您还可以指定一个类来链接您的库资源(我已经忘记了这一点:-)。这使您可以在创建资产实例时添加自定义行为;例如,您可以将 MovieClip 资源链接到扩展 MovieClip 的类。然后,每当您在代码中实例化该资产的实例时,它们都将具有链接类的所有行为。

You can use a document class, which lets your scripts reside exclusively in files (instead of on the frame).

This is the only other method that I am aware of for linking code to a project in the Flash authoring tool.

UPDATE:
As others have mentioned, you can also specify a class to link your library assets to (I had forgotten about this :-). This lets you add custom behaviour when creating instances of your assets; for example, you can link a MovieClip asset to a class that extends MovieClip. Then, whenever you instantiate instances of that asset in your code, they will have all the behaviour of the linked class.

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