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.

#1252 Is it possible to create a new method?
Author:
rogal

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

I would like to add a new method to the existing AS3 SWF.
The p-code below creates an empty public static method:
trait method Qname(PackageNamespace(""),"testMethod") dispid 3
method
name null
returns Qname(PackageNamespace(""),"void")
body
maxstack 5
localcount 7
initscopedepth 8
maxscopedepth 9
code
getlocal_0
pushscope
pushnan
newfunction 6500
pop
returnvoid
Now I can paste this code just below existing method p-code, but as the result old method
gets its header replaced by new code, with body unchanged. I can also remove old code and
paste the new one. The result is a new method, but I lost old one.
It would also be helpful if I knew what is the purpose of "dispid" instruction.
Also I would like to thank you, Mr. Jindra and other developers for creating this amazing
software. I've tried many flash decompilers, but this one is definitely the best. Good
work, keep going!
From Adobe's documentation (you can find the link to this documentation in the links page,
/www.free-decompiler.com/flash/links/):
The disp_id field is a compiler assigned integer that is used by the AVM2 to optimize the
resolution of virtual function calls. An overridden method must have the same disp_id as
that of the method in the base class. A value of zero disables this optimization.
Thank you, however I need to create a new method, not override existing one. Is this
possible?
Ok, I answered only to this question: "It would also be helpful if I knew what is the
purpose of "dispid" instruction."
As far as I know, currently it is not possible, only with direct editation.
You can use the add trait button on the toolbar above script editor to add new method to
class.
State: new→upgraded
State: upgraded→closed