简体   繁体   English

将符号从AS2 SWF加载到AS3应用程序中?

[英]Loading symbols from an AS2 SWF into an AS3 application?

I am converting a large application from AS2 to AS3. 我正在将一个大型应用程序从AS2转换为AS3。 Part of the function is that it loads assets embedded in SWFs, which are old things. 该功能的一部分是它加载嵌入在SWF中的资产,这些资产已经过时了。 It is not possible to convert these to AS3 (there's really no code in them, it's just they're produced by tools that output flash 6 compatible SWFs). 无法将它们转换为AS3(它们中实际上没有代码,只是它们是由输出Flash 6兼容SWF的工具产生的)。

The question is, how can I use this AVM1 (ActionScript VirtalMachine 1) graphical content inside an AVM2 application? 问题是,如何在AVM2应用程序中使用此AVM1(ActionScript VirtalMachine 1)图形内容?

Here's what I used to do in AS2: 这是我在AS2中曾经做过的事情:

mcLoader = new MovieClipLoader();
mcLoader.addListener(this);
holder = createEmptyMovieClip('holder', 10);
mcLoader.loadClip("http://.../library.swf", holder);
function onLoadInit() {
  holder.attachMovie('GFXsymbolInsideLibraryswf', 'mysymbol', 123);
}

How can I do the same thing in AS3, loading the AS2 library swf? 如何在AS3中做同样的事情,加载AS2库swf? Am I going to need another layer of a 'wrapper' SWF that communicates via LocalConnection? 我是否需要通过LocalConnection进行通信的“包装” SWF的另一层? Please tell me there's an easier way. 请告诉我,有一种更简单的方法。 Can I flip the bits on Library.swf to force it to load as an AVM2 SWF? 我可以翻转Library.swf上的位以强制将其作为AVM2 SWF加载吗? Since there is no code inside it, maybe that would work? 既然里面没有代码,也许行得通吗?

通过将旧版swf加载到AS3中的AVM1Movie对象中,可能是最好的选择。

This looks like it may do what I want, I will update this answer later if I figure it out and nobody else replies. 看起来它可以满足我的要求,如果我弄清楚了,没有其他人答复,我将在稍后更新此答案。

EDIT: Nevermind. 编辑:没关系。 This doesn't work for what I want to do. 这不适用于我想做的事。 I ended up having to use an intermediate wrapper SWF. 我最终不得不使用中间包装SWF。 I'm going to assume for now what I want is impossible to do. 我现在要假设我想要做的事是不可能的。 If anyone else has any suggestions, please leave an answer and I'll consider it. 如果其他人有任何建议,请留下答案,我会考虑的。

"Flipping" the bites is quite easy. “翻转”叮咬非常容易。 I don't know if it will work, but you can give it a try. 我不知道它是否会起作用,但是您可以尝试一下。 Since you have no code, you might actually have a chance... 由于您没有代码,因此实际上可能会有机会...

Anyway, open up your swf with an hex editor. 无论如何,请使用十六进制编辑器打开SWF文件。 The version number is the fourth byte. 版本号是第四个字节。 You'll see something like this for a swf exported for FP 6: 对于为FP 6导出的swf,您将看到以下内容:

43 57 53 06 43 57 53 06
This is the signature plus the version number. 这是签名加上版本号。 The first 3 bytes are the ascii string "CWS", which means the swf is compressed. 前3个字节是ascii字符串“ CWS”,表示swf已压缩。

46 57 53 06 This is the signature for an uncompressed swf, "FWS". 46 57 53 06这是未压缩的swf“ FWS”的签名。

Try changing 06 to 09 and see if it works... 尝试将06更改为09,看看是否可行...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM