如何分发与 MTASC 一起使用的 Flash 组件?
我有一个 Flash 组件,它只是一个包含一些公开的 API 调用的已编译代码库。 通常我们将其分发为 SWC 或 MXP,并且它工作得很好。 最近,我有一位客户表示有兴趣使用我的组件,但他们仅在 MTASC 中进行所有开发。 MTASC 不支持 SWC 文件,因此有没有一种好方法来发送可在 MTASC 中工作的预编译代码? 我无法向他们发送原始源代码,但如果有其他方法,我将不胜感激。 我确实可以访问源代码,因此我可以根据需要重新编译它。 谢谢!
I have a Flash component that's just a library of compiled code with some exposed API calls. Normally we distribute this as a SWC or MXP, and it works just fine. Recently I had a client express interest in using my component, but they do all their development in MTASC only. MTASC doesn't support SWC files, so ss there a good way to send precompiled code that would work in MTASC? I'm not able to send them the original source code, but if there's some other method I'd appreciate it. I do have access to the source, so I can recompile it however necessary. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我确实找到了答案,但我不能 100% 确定这是否正是这个过程,因为我不再从事那份工作,并且我面前不再有计算机/过程。 这有点像黑客。
它涉及的基本上是解压缩 SWC 文件并获取 .swf 和一堆 .asi 文件。
.asi 文件实际上只是 ActionScript 文件,但它们包含内在定义,或者只是实际存在的原型或足迹。 它的真正核心仍然在 .swf 中。
因此,您将所有这些 .asi 文件重命名为 .as,然后将它们放入 MTASC 类路径中。 由于它们包含定义,因此您在编译时不应再收到任何“未定义的变量”或“未定义的函数”错误。 现在您只需使用 loadMovie 拉入定义了实际函数体的 SWF。 一旦 loadMovie 完成,您应该能够使用所有功能。
当然,唯一需要注意的是,在调用 SWC 中的任何函数之前,您必须等待 SWF 加载。
一步一步,它看起来像这样:
1.) 解压缩 SWC 文件。 这可以使用 WinZip 或 OS X 终端解压缩命令来完成
2.) 将 .asi 文件重命名为 .as
3.) 将新的 .as 文件添加到 MTASC 类路径
4.) 添加 AS 代码来加载 .swf,并确保在加载 SWF 之前不会调用任何 SWC 函数
5.) 编译
我很确定这就是我们所做的,但我现在无法尝试。
希望这有帮助,如果您有任何其他问题,请告诉我,我会看看是否我可以再帮忙弄清楚。
I did find an answer, and I'm not 100% sure if this is exactly the process since I'm no longer at that job and don't have the computer/process in front of me anymore. It was a bit of a hack.
What it involved basically was unzipping the SWC file and getting a .swf and a bunch of .asi files out.
The .asi files are really just ActionScript files, but they contain intrinsic definitions, or just prototypes or footprints of whats actually there. The real meat of it is still in the .swf.
So you rename all those .asi files to .as and then put them into your MTASC classpath. Since they contain definitions, you shouldn't be getting any more "undefined variable" or "undefined function" errors at compile time. Now you just need to pull in the SWF, where the actual function bodies are defined, using loadMovie. once the loadMovie is complete, you should be able to use all of the functions.
The only caveat of course is that you have to wait for that SWF to load before calling of any of the functions from the SWC.
so step-by-step, it looks like this:
1.) unzip the SWC file. this can be done using WinZip or OS X terminal unzip command
2.) Rename .asi files to .as
3.) add new .as files to MTASC classpath
4.) add AS code to load the .swf in and make sure none of the SWC functions are called before the SWF is loaded
5.) compile
I'm pretty sure this is what we did, but i'm not in a spot to try it out right now.,
Hope this helps, let me know if you have any other questions and I'll see if I can help figure it out any more.