: WARNING - support of the decompiler is now VERY LIMITED. There are no active developers. This means waiting times in the issue tracker are very long and mostly depend on community. Sorry for the inconvenience.

List of issuesList of issues

#223 AS2 Detecting uninitialized class fields
Author: user focus
Date created:
Type: bug
Visibility: Everybody
Assigned to:
Labels: AS1/2
State: returned Help

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
DownloadFirst.swf (28 KiB)
user
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
DownloadTUc1wxO.png (4 KiB)
admin
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
user
Hm.. It is done in Sothink and Trillix somehow...
user
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...
user
Looks like all this constants can be filtered out (some are global, some are methods, etc.) leaving class variables only.
user
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
admin
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
admin
Title: AS2 decompilation error (no variables detected)→AS2 Detecting uninitialized class fields
user
Oh, I see.. Hope you'll be able to find some solution for this, thanks in advance!
admin
State: new→opened
admin
version 1.7.0 was released this should be better, try it
State: opened→upgraded
user
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".
user
And one more addition - FFDec adds the default fields into vars, like _x, _y, _width, etc. for MovieClips.
user
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
Downloadship.swf (6 KiB)Downloadthings.as (1 KiB)
admin
State: upgraded→returned
user
Any news on it?
 
Google Translate: Translate to Czech Translate to Slovak Translate to Russian Translate to Hungarian Translate to Swedish Translate to French Translate to German Translate to Spanish Translate to Italian
Change style: oceanic classic