如何从动作脚本文件生成 SWF 文件?

发布于 2024-11-02 14:36:40 字数 128 浏览 4 评论 0原文

您好,我有一个显示按钮的动作脚本文件。我想从显示屏上删除该按钮。所以我需要对动作脚本代码进行更改,并在更改后生成一个新的 SWF 文件。

任何人都可以帮助我了解如何从动作脚本文件生成 SWF 文件。

提前致谢。

Hi I have an actionscript file which is displaying a button. I want to remove the button from my display. So i need to make changes to the actionscript code and generate a new SWF file after doin the changes.

Can anyone kindly help me regarding how to generate an SWF file from an actionscript file.

Thanks In Advance.

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

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

发布评论

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

评论(3

始终不够爱げ你 2024-11-09 14:36:40

我认为您是在问使用什么将 as3 编译为 .swf 文件。

您的源文件是 .fla 还是 .as 文件?请记住,.swf 不是源文件,而是编译后的文件。因此,如果您想即时修改它,您可以使用上面 anemgyenge 建议的方法。

否则,如果“即时”不是您的意图,您需要对其进行反编译 - 这并不能真正产生高质量的源代码,因为反编译的符号可能很难使用。

Flash CS5 可以编译为 .swf,您的主要源文件是 .fla 和 .as 代码文件。

Flex SDK 可以将 AS3 编译为 .swf,您可以使用 Flex Builder 或 Flash Develop 作为 IDE 来编辑 as3 代码。

FlashDevelop 是免费的,您可以在这里获取:

FlashDevelop 下载页面< /a>

您需要 Flex SDK 才能使用 FlashDevelop 进行编译,因此您需要在此处获取:

Flex SDK - 您可以使用 3 或 4

如果您想修改它,为什么不尝试一下 Wonderfl.net。就网站的布局而言,它有点草率,但是有大量的代码可供学习,而且您不需要安装任何东西!

I think you are asking what you use to compile as3 to a .swf file.

Is your source file a .fla or a .as file ? Keep in mind that a .swf is not a source file, it is the compiled file. So if you wanted to modify that on the fly, you could use the method suggested by anemgyenge above.

Otherwise, if "on the fly" is not your intention you'd need to decompile it - which doesn't really result in quality source as the decompiled symbols can be hard to work with.

Flash CS5 can compile to a .swf, and your main source file is a .fla and .as for code files.

Flex SDK can compile AS3 to a .swf, and you can use either Flex Builder or Flash Develop as an IDE for editing your as3 code.

FlashDevelop is free and you can get it here :

FlashDevelop Download Page

You need the Flex SDK to compile with FlashDevelop, so you'll need to get that here :

Flex SDK - you can use either 3 or 4

If you are looking to tinker with it, why not try out wonderfl.net. It is a little sloppy in terms of the layout of the site, but there is tons of code to learn from and you don't need to install anything!

若无相欠,怎会相见 2024-11-09 14:36:40

如果您仍然遇到问题并且需要快速解决方案,那么您可以尝试采取解决方法,而不是“更改动作脚本代码并生成新的 SWF”。

将带有按钮的 swf 文件嵌入到新的 Flash 项目中:
为此,请使用 Embed 元标记并将文件嵌入为 ByteArray,然后将其加载到 Loader 对象。

[Embed(source="filename-of-swf-with-button", mimeType="application/octet-stream")]
var class1:Class;

var ldr:Loader = new Loader();
ldr.loadBytes(new class1());

之后,您可以通过ldr.content访问“swf”内容。
就这样,如果您知道实例的名称,请将其设置为不可见或将其从显示列表中删除。如果您不知道该名称,请尝试以困难的方式找到它:

for(var i:int = 0; i < ldr.content.numChildren; i++)
{
     trace(ldr.content.getChildAt(i).name);
}

搜索后,选择按钮实例。

If you still have the problem and need a quick solution, then instead of "changing the actionscript code and generate a new SWF", you can try to do a workaround.

Embed the swf file with the button in a new flash project:
for this use the Embed metatag and embed the file as a ByteArray then load it to a Loader object.

[Embed(source="filename-of-swf-with-button", mimeType="application/octet-stream")]
var class1:Class;

var ldr:Loader = new Loader();
ldr.loadBytes(new class1());

After this you can reach the "swf's" content by ldr.content.
There you go, if you know the name of the instance, make it invisible or remove it from the displaylist. If you don't know the name, then try to find it the hard way:

for(var i:int = 0; i < ldr.content.numChildren; i++)
{
     trace(ldr.content.getChildAt(i).name);
}

and after the search, pick the button instance.

愿与i 2024-11-09 14:36:40

您是否要求即时生成(在运行时)或将 AS 文件编译为 SWF 文件?如果您只是想将 AS 文件编译为 SWF,您可以在各种 ActionScript IDE(Flash Builder、Flex、FlashDevelop [我最喜欢的])中创建一个新项目,将相关文件包含为您的主应用程序文件,然后编译如果一切顺利的话...很快 - 你就有了一个 SWF!

每个 IDE 将上述“*.as”文件设置为主应用程序文件的方法略有不同。您必须确保它扩展 Sprite 或 MovieClip 类(或已经执行此操作的另一个基类),以便它有一个将自身附加到舞台的入口点。

Are you asking to generate on the fly (at runtime) or to compile the AS file to a SWF file? If you're just looking to compile an AS file to a SWF, you can create a new project in various ActionScript IDEs (Flash Builder, Flex, FlashDevelop [my favorite]), include the file in question as your Main application file, compile it, and if everything runs well... presto - you have a SWF!

Each IDEs have slightly different ways to set the said "*.as" file as the main application file. You must make sure it extends the Sprite or MovieClip class (or another base-class that does this already) so it has a point-of-entry to attach itself to the Stage.

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