Recently I was playing with the decompiler after reading doug’s post about decompile flex code, and got to say that my inner geek wanted a ABC debugger just to see how it behaves in run time and understand better the ABC code (I don’t know if such thing exist but it would be soooo nice)…
You’ll need some tools, and Sothink Decompiler is a very good one, but it won’t give you the same clean result as decompiling Java code, next there are a couple of air apps that will show you the ABC code and help you fix the error in the decompiled code. These are LibraryManager and Nemo 440, both gives you the ABC but the first one is more organized IMHO although it eats some of the functions header and you’ll need this, so I used both programms.
And last but not least, as Doug point it out in his blog, there are the SWF and AVM 2 Specs docs, I used more the last one just to trying to figure out what the ABC was doing.
So, here are some tips:
- if you see something like var private::_1455875791myVar:Object /* slot_id 0 */, and then a function like [Bindable(event="propertyChange")]
function get myVar():Object /* disp_id 0*/ { //Some ABC Code }
function set myVar(Object):void /* disp_id 0*/ { // More ABC Code }
this mean the there is a Bindable var named myVar so you could just replace this with
[Bindable] private var myVar:Object
- Imagine you have a class named MyClass (pretty creative) and you see another class under a package named MyClass.AS$42 means that the second class is a inner inside MyClass, so don’t try to add that package because you’ll get reference errors.
- I don’t know if this is 100% correct but when you see /* slot_id 0 */ means private function or var and /* disp_id 0*/ is a public one
These are some things that I learned while browsing the ABC, is not much but hope it helps someone…Recientemente he estado jugando con el decompilador luego de leer el post de doug hacerca de decompilar código flex,y tengo que decir que mi geek interno quizo un debugger de código ABC solo para ver como se comporta en tiempo de ejecución y así entender un poco mas sobre ABC (no sé si esto es posible pero de ser así seria espectacular)
Vas a necesitar algunas herramientas, y Sothink Decompiler es una MUY buena, pero no produce el mismo resultado como una herramienta que decompile código Java, luego cuentas con un par de aplicaciones Air que te pueden mostrar el código ABC para poder entender y corregir cualquier error en el código decompilado; estas son LibraryManager y Nemo 440, ambas te producen el mismo ABC aunque la primera me parece un poco más organizada (en mi opinión) aunque se come algunos de los encabezados de las funciones y esto lo vas a necesitar, por esto estuve probando con ambas aplicaciones
Y de último pero no menos importante, como Doug lo menciona en su blog, están los estandares de SWF y AVM2, los que yo utilizé para tratar de figurar que hacia el ABC.
Aqui hay unos tips:
- Si ves algo como var private::_1455875791myVar:Object /* slot_id 0 */, y luego una función como [Bindable(event="propertyChange")]
function get myVar():Object /* disp_id 0*/ { //Some ABC Code }
function set myVar(Object):void /* disp_id 0*/ { // More ABC Code }
significa que hay una variable Bindable llamada myVar, por lo que todo lo anterior puede ser reemplazado por
[Bindable] private var myVar:Object
- Imaginate que tienes una clase llamada MyClass (muy creativo jejeje) y ves otra clase en una carpeta (package) llamado MyClass.AS$42 significa que la segúnda clase es una clase interna ubicada en MyClass, no trates de agregar ese paquete porque tendrás errores de referencia.
- No sé si esto es cierto 100% pero cuando veas /* slot_id 0 */ quiere decir que es una función o variable privada y /* disp_id 0*/ una pública.
Estas son algunas cosas que aprendi mientras navegaba el código ABC, no es mucho pero espero que a alguien le ayude…