package { import flash.display.MovieClip; import flash.events.Event; import flash.geom.Rectangle; import flash.text.TextField; public class FlashTest extends MovieClip { public function FlashTest() {([ <comment> i removed all 'var' declarations. plus using many 'with' and 'this' keywords, things got mess and more confusing... </comment> ]).forEach(function():void { with (this) { with (textField = addChild(new TextField)) text = "drag circle", selectable = mouseEnabled = false, width = 100; addChild(slider = makeSlider. call(new constructor)); slider.addEventListener("change", (function (textField:TextField):Function { return function ():void { with (arguments[0]. currentTarget) textField.text = percent; }; } )(textField)); } addChild(this); }, new MovieClip); function makeSlider():MovieClip { with (this) { change = new Event("change"); onChange = function ():void { with (arguments[0].currentTarget) percent = getChildAt(0).y / 100, dispatchEvent(change); }; x = y = 100; buttonMode = true; with (graphics) lineStyle(0, 0), lineTo(0, 100); with (addChild(new constructor)) { with (graphics) beginFill(0), drawCircle(0, 0, 10); addEventListener("mouseDown", function ():void { with (arguments[0].currentTarget) { startDrag(false, new Rectangle(0, 0, 0, 100)); with (parent) { addEventListener("enterFrame", onChange); }}}); } stopDragging = (function (circle:MovieClip):Function { return function (): void { with (circle) { stopDrag(); with (parent) removeEventListener("enterFrame", onChange) }}; } )(getChildAt(0)); addEventListener("addedToStage", function ():void { (["mouseUp", "mouseLeave"]).forEach(function ():void { with (this) stage.addEventListener(arguments[0], stopDragging); }, arguments[0]. currentTarget);}); } return this; } } } } Obfuscated Slider - without 'var' declarations