Laan's steps..

Feed Rss

GenericName in flash 10

05.30.2009, air, flash, flex, by .

During the develepment of DoSWF, I had encountered a problem in decoding abc data. Sometimes, there is a Multiname of kind 0x1d(29). But in the adobe’s avm2overview.pdf file, that kind of Multiname is not documented.So, The DoSWF will throw a error once the swf file has that kind of Multiname.

But totay, I searched in google using key words:multiname 0x1d, I found a very useful page:

The available documentation for the AVM2 does not include the updates made in flash player 10. Specifically:
- The multiname kind defined by 0x1D (I’m guessing something to do with the Vector type?)
- Documentation on the vector type (if unrelated to the above): references to it (with type) and how it’s declaread (without type)
- The instructions for bytearray access

Actually, some body have got the same problem, and he reported it as a bug to adobe. It’s very intereting. Finnally, that problem is not a bug. But the engineer also replied his question:

0x1D can be considered a GenericName multiname, and is declared as such:

[Kind] [TypeDefinition] [ParamCount] [Param1] [Param2] [ParamN]

[TypeDefinition] is a U30 into the multiname table
[ParamCount] is a U8 (U30?) of how many parameters there are
[ParamX] is a U30 into the multiname table.

Obviously generics are not generally supported yet, so ParamCount will always be 1 (for Vector.<*>).

More information, please check here:

So, I added a new class named GenericName to decode the Genaricname multiname. It works well. But another problem rises: a instruction(0×53) is can not be decoded. It is also a new content in flash 10 for Vector. I found another page:

A new opcode was added in Flash 10 (0×53), which I will call MakeGenericType. MakeGenericType is declared with the following stack:

TypeDefinition, ParameterType1, ParameterTypeN -> GenericType

It also has one parameter, a U8 (U30?) specifying how many parameters are on the stack. You will generally see MakeGenericType being used like this:

GetLex [TypeDefinitionMultiname]
GetLex [ParameterTypeMultiname]
MakeGeneric [ParamCount]
Coerce [GenericNameMultiname]
Construct [ConstructorParamCount]

So if you had the following…

GetLex __AS3__.vec::Vector
GetLex int
MakeGeneric 1
Coerce __AS3__.vec::Vector.<int>
Construct 0

You would now have an instance of Vector.<int>


电子邮件地址不会被公开。 必填项已用 * 标注


您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>