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.

#223 AS2 Detecting uninitialized class fields
Author:
focus

Date created:
Type: bug
Visibility: Everybody
Assigned to:
Labels: AS1/2
State: closed 

Please look at the mx.skins.ColoredSkinElement class.
It will not compile back:
ColoredSkinElement.as, Line 17 There is no method with the name 'getStyle'.
I guess there are some variables in that class: getStyle, _color, onEnterFrame but I can't
see them in FFDec.
Original class: https://github.com/silexlabs/Silex/blob/master/framework/as2/mx/skins/ColoredSkinElement.a
s

Oh And I can see link is wrapper not correctly in this issue:
http://i.imgur.com/TUc1wxO.png
Chrome 27.0.1453.116 m

You cannot see them in FFDec because they are not present in the bytecode.
AS2 classes bytecode does not contain uninitialized fields.
I can only "detect" it by looking into object methods and see where "this.getStyle" is
read/stored/called and then create such field. This may be hard or impossible, because
this.xxx fields may come from inheritance or be assigned outside of class.
Example:
//this classes stores to Two.myvar
class One {
function tst(){
var o=new Two();
o.myvar = 5;
}
}
//This class contains field myvar, but it is not mentioned in this class bytecode
class Two {
var myvar; //FFDec cannot see this field
var okvar=5; //This field is ok because it is assigned
}
//This class reads myvar, previously assigned by class One
class Three{
function readIt(t:Two){
trace(t.myvar);
}
}
As you can see, it is not easy to detect and I think it is even impossible in some cases.
Or do you have any idea how to do it?
State: new→postponed
Hm.. It is done in Sothink and Trillix somehow...
I guess it can be pulled out from constants:
constants '_global', 'mx', 'Object', 'skins', 'ColoredSkinElement', 'prototype',
'setColor', 'Color', 'setRGB', 'draw', '_color', 'getStyle', 'onEnterFrame',
'invalidateStyle', 'setColorStyle', 'mixins', 'ASSetPropFlags'
but I'm not sure about this...
Looks like all this constants can be filtered out (some are global, some are methods,
etc.) leaving class variables only.
Any chance to reanimate this issue? All popular decompilers with as2 support can extract
class variables from those constants... It shouldn't be so hard I guess :P
I cannot extract variables from these constants as these constants are names of all
variables/strings in the file which means everywhere where is the field read or written
to.
To reconstruct unassigned fields definitions of class C I have to decompile all classes
first and look where there are attributes of C read or written. (FFDec currently
decompiles classes on demand)
This is not a trivial thing.
I know it is pain in the ass for you,
maybe I can figure out something... stay tuned. I now make this issue "new".
State: postponed→new
Title: AS2 decompilation error (no variables detected)→AS2 Detecting uninitialized class fields
Oh, I see.. Hope you'll be able to find some solution for this, thanks in advance!
State: new→opened
version 1.7.0 was released
this should be better, try it
State: opened→upgraded
Yey, it's much better now, but looks like something still works wrong here..
I see this variables (for the class from first post):
var draw;
var onEnterFrame;
var _color;
but that class have method draw().
Looks like "getStyle" variable should be declared instead of "draw".
And one more addition - FFDec adds the default fields into vars, like _x, _y, _width, etc.
for MovieClips.
Here is another example with some undetected static vars.
Please, take a look at the class things in attached swf.
FFDec detects such variables there:
var _x;
var _visible;
var _y;
var move;
static var speed = 5;
static var arr = [];
but originally it was:
static var speed : Number = 5
static var st : Number;
static var arr : Array = [];
static var X : Number ;
static var Y : Number;
static var H : Number;
static var B : Number;
static var K : Number;
static var i : Number;
static var X1 : Number
static var Y1 : Number
State: upgraded→returned
Any news on it?
Hi. I am faced with the same problem, there is still no way to solve it?
This is implemented in nightly 2627.
It may slowdown first opening of AS2 class as it needs to walk whole file (and decompile
it) for references.
We will see how much this would be a problem for users...
State: returned→upgraded
State: upgraded→closed