简体   繁体   中英

Loading symbols from an AS2 SWF into an AS3 application?

I am converting a large application from AS2 to AS3. Part of the function is that it loads assets embedded in SWFs, which are old things. 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).

The question is, how can I use this AVM1 (ActionScript VirtalMachine 1) graphical content inside an AVM2 application?

Here's what I used to do in 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? Am I going to need another layer of a 'wrapper' SWF that communicates via LocalConnection? 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? 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. 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. The version number is the fourth byte. You'll see something like this for a swf exported for FP 6:

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.

46 57 53 06 This is the signature for an uncompressed swf, "FWS".

Try changing 06 to 09 and see if it works...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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