From: http://www.itfeed.cn/post.asp? Id = 10197
In fact, the concise statement here is that AVM2 loads the swf of AVM1.
Actionscript1.0 (flash 1.0-6.0) corresponds to the Virtual Machine AVM1, based on ECMA-262 V2 (equivalent to javascript1.2)
Actionscript2.0 (flash 7.0-8.0) corresponds to the Virtual Machine AVM1, based on ECMA-262 V3 (equivalent to javascript1.5)
Actionscript3.0 (flash9.0 --) corresponds to the Virtual Machine AVM2, based on the ECMA-262 V4
There are already many flash games written by as2 or as1 on the Internet. to change these games, the proportion of new games is much faster. Last year, around two months ago, I made a special flash game. At that time, I made a simple change and didn't need to change some of the resources, you only need to find the events and scores of the game at the start and end of the game. The specific changes are as follows:
1. When a user clicks the game, the flash calls back js and JS to handle the game. If a request is sent to the background, the user has already played the game, the prompt on the page needs to be changed.
2. After a user finishes playing a game, the user needs to return the score to js and then the JS will pass the score to the background through ajax. Of course, the score can be written directly in the flash code like in the white community, however, other web pages also need to get the score and compare it with the score of the current user's friend (you do not need to request the friend data of this game from the server, and you have already requested the score once when you enter the page, the data that needs to be operated on the memory and then re-rendered to the page ).
3. Game re-start processing (there are two solutions, one is to re-initialize the flash directly, and the other is that each small flash provides a method to re-start the game)
Let's talk about the problems encountered (many problems are really unpredictable ):
1. For two swf files written in flash as3, you can set wmode = "transparent" to achieve mutual penetration between the two flash files. The visible part can be penetrated, flex writing cannot be implemented .?!!! However, you can set the bottom SWF wmode = "opaque" and the upper-layer transparent, but it also produces serious latency in SWF.
2. When the DIV/iframe of a webpage is used in FF, the content of the DIV is continuously jitters when it is definitely located in the swf area written by flex. (If the SWF is not set to transparent), and when the SWF gets the focus, the DIV or iframe disappears. However, if you set transparency, rendering and operations on the primary swf (as3.0) will be greatly discounted.
3. stopAllSounds () compiled by as2.0/as1.0 can also disable all the main swf sounds written by as3.0.
4. In as2.0/as1.0, a Sound can be played through new Sound, but the main swf (as3.0) cannot play the Sound after loading it. You must create a MC, then new Sound (mcObj) is returned, and a variable is returned to play the Sound through attachSound. However, if the "depth" of the MC is specified by the second parameter when createEmptyMovieClip is used, this value is as big as possible, but it cannot be overwritten by other MC instances, otherwise there will be no sound (I have been playing for at least three hours to find the second level of the game, and there will be no sound problem, a blood lesson !)
5. Even if the SWF written in as3.0 is removed from the SWF written in as2.0/as1.0 after the game ends, the SWF cannot be executed. The onEnterFrame in as2.0 or as1.0 consumes resources, which is related to the frame rate of the SWF. (That is, the number of calls to this function at a time)
6. By default, the SWF of as2.0 or as1.0 is loaded in as3.0. Its frame rate is the current frame rate of as3.0, but it can be set. However, when the game ends, it may not be set back. This is very mysterious.
7. lockroot = true does not work at all, and it will have some impact on the container as3.0 that loads it.
Communication between as3.0 and SWF compiled by as2.0/as1.0 is also a very painful task. I have been trying it before, and I gave up on it. There are too many problems, which can make people crash. Although there are many ways to solve communication problems such as local communication, the most important problem is that such a mechanism is used to load bugs at any time, but you are powerless.