/**
* Copyright makc3d ( http://wonderfl.net/user/makc3d )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/pBeH
*/
// forked from Glidias's Classes as dynamic objects
package {
import flash.display.Sprite;
import flash.display.DisplayObject;
import flash.text.TextField;
public class ClassesAreDynamicObjects extends Sprite {
private static var PRIVATE_VAR:Number = 999;
public function ClassesAreDynamicObjects() {
var field:TextField = new TextField();
field.autoSize = "left";
addChild(field);
var anonymous:* = ClassesAreDynamicObjects;
anonymous["PRIVATE_VAR"] = 123; // it seems the compiler doesn't treat anonymous as really anonmous under this scope, writing to my own private namespace
field.appendText(",\n"+ClassesAreDynamicObjects["PRIVATE_VAR"]+", "+PRIVATE_VAR + "<- LOl. what the heck. I replaced my own private static var PRIVATE_VAR");
new Test(ClassesAreDynamicObjects, field);
field.appendText(",\n"+ClassesAreDynamicObjects["PRIVATE_VAR"]+", "+PRIVATE_VAR + "<- LOl. what the heck. It is still 123");
}
}
}
class Test {
function Test (c:*, tf:*) {
tf.appendText("\n123 == " + c["PRIVATE_VAR"]);
c["PRIVATE_VAR"] = 456;
tf.appendText("\n456 == " + c["PRIVATE_VAR"]);
}
}