If you are looking for the decompiler itself, visit https://github.com/jindrapetrik/jpexs-decompiler
NEW : We have got a new blog where we post some interesting SWF internals info.

#2186 CallPropVoid Multiname.
Author:
SamHoque

Date created:
Type: question
Visibility: Everybody
Assigned to:
State: closed 

> What steps will reproduce the problem?
I am using the ffdec library and using this piece of code.
int emit = abc.constants.getMultinameId(
Multiname.createMultiname(
false,
abc.constants.getStringId("emit", true),
abc.constants.getNamespaceId(Namespace.KIND_PACKAGE,
abc.constants.getStringId("", true), 0, true)
), true);
parsedAVM2Code.insertInstruction(pushScopeIndex, new AVM2Instruction(0,
AVM2Instructions.CallPropVoid, new int[]{emit, params + 1}), true, body);
> What is the expected output? What do you see instead?
The expected output should be: callpropvoid
Multiname("emit",[PackageNamespace(""),Namespace("http://adobe.com/AS3/2006/builtin"),Packa
geInternalNs(""),PackageNamespace("x.x.x"),PackageNamespace(xcom.x.x"),PackageNamespace("c
om.x.x"),PackageNamespace("com.x"),PackageNamespace("com.sfs.data"),PackageNamespace("fl.c
ontainers"),PackageNamespace("fl.controls"),PackageNamespace("fl.data"),PackageNamespace("
flash.display"),PackageNamespace("flash.events"),PackageNamespace("flash.filters"),Package
Namespace("flash.geom"),PackageNamespace("flash.net"),PackageNamespace("flash.system"),Pac
kageNamespace("flash.text"),PackageNamespace("flash.ui"),PackageNamespace("flash.utils"),S
taticProtectedNs("flash.display:MovieClip"),StaticProtectedNs("flash.display:Sprite"),Stat
icProtectedNs("flash.display:DisplayObjectContainer"),StaticProtectedNs("flash.display:Int
eractiveObject"),StaticProtectedNs("flash.display:DisplayObject"),StaticProtectedNs("flash
.events:EventDispatcher"),PrivateNamespace("x"),ProtectedNamespace("x"),StaticProtectedNs(
"x"),PrivateNamespace("x.as$0")]), 2
What I see: callpropvoid Multiname("emit",[PackageNamespace("")]), 1
> What version of the product are you using? Is it "nightly build"? Which operating system
do you have?
20.0
> Please provide any additional information below. If the problem is related to a SWF
file, attach it here, otherwise we can't help you.
Multiname.createMultiname method has parameters: attribute, name_index,
namespace_set_index.
You pass return value abc.constants.getNamespaceId() to namespace_set_index parameter
which is incorrect.
You must differentiate between namespace and namespace_set.
This is how it should work:
int[] namespaces = new int[2];
//populate all namespaces in the set
namespaces[0] = abc.constants.getNamespaceId(Namespace.KIND_PACKAGE,
abc.constants.getStringId("first", true), 0, true);
namespaces[1] = abc.constants.getNamespaceId(Namespace.KIND_PACKAGE,
abc.constants.getStringId("second", true), 0, true);
...
int namespace_set_id = abc.constants.getNamespaceSetId(namespaces, true);
int multiname_id = abc.constants.getMultinameId(
Multiname.createMultiname(
false,
abc.constants.getStringId("emit", true),
namespace_set_id
), true);
Type: bug→question
But, how do we know what namespaces to load? is there a list of all namespaces used for
this?
You can use whathever list of namespaces you want.
During compilation, these are usually populated from imports.
During execution, a name "emit" is searched in these namespaces until one is resolved on.
If you want to generate code and you already know proper namespace to use, then use QName
instead of Multiname, QName has single namespace instead of set.
But I don't know details. Just consult AVM2 manual.
State: new→opened
Thank you, I used a QName instead and now it works perfectly.
You're welcome.
State: opened→closed