In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

Obfuscated Slider - without 'var' declarations

Get Adobe Flash player
by 9re 18 Nov 2009
/**
 * Copyright 9re ( http://wonderfl.net/user/9re )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/xaPv
 */

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;
    }
    
    }
}
}