Ok. This is an example of what is technically legal, according to the current rules, but it probably should be illegal, as it enables you to do a LOT more. If I wrote it without using the chain function, it would be at least 25 lines, and possibly more.
This is just an example for now, so ignore how glitchy parts of it are. It took a LONG time to create, and it’s incredibly hard to follow, because it was the equivalent of writing a few hundred lines of code.
This technique uses less ‘for’ loops, and more linking of chain functions, so you’ve basically gotta write normal code, but it takes way longer to input it. (There’s also one line that’s well over 3000 characters long, so it’s split onto multiple lines… would that count as 1 or 4?)
It’s only 12 lines with the current counting rules, and there are now no import statements.
function chain(p_scope:Object, p_methodToCall:String, p_params:Array):Object {
p_scope[p_methodToCall](p_params[0], p_params[1], p_params[2], p_params[3], p_params[4], p_params[5], p_params[6], p_params[7], p_params[8]);
return this;
}
Object.prototype.applyProps = function(p_source:Object):Void {
for (propName in p_source) {
this[propName] = p_source[propName];
}
};
function createInterval(p_scope:Object, p_methodName:String, p_interval:Number) {
setInterval(p_scope, p_methodName, p_interval);
}
chain(this, "createEmptyMovieClip", ["circleHolder_mc", 1]).chain(this, "applyProps", [{dropShadowA:new flash.filters.DropShadowFilter(-3, 45, 0x000000, 100, 10, 10, .5, 1, true, false, false), dropShadowB:new flash.filters.DropShadowFilter(1, 45, 0x000000, 100, 15, 15, .4, 1, false, false, false), dropShadowC:new flash.filters.DropShadowFilter(0, 45, 0xEE4400, 20, 20, 100, .6, 1, true, true, false), dropShadowD:new flash.filters.DropShadowFilter(0, 45, 0xFFFFFF, 100, 150, 150, 1, 1, true, true, false), dropShadowE:new flash.filters.DropShadowFilter(0, 45, 0xFFFFFF, 100, 10, 10, 2, 1, true, true, false)}]).chain(this, "createEmptyMovieClip", ["starburst_mc", -10]).chain(this, "createEmptyMovieClip", ["borderA_mc", 100]).chain(this, "createEmptyMovieClip", ["borderB_mc", 101]);
chain(this.borderA_mc, "lineStyle", [1, 0x000000, 0]).chain(this.borderA_mc, "beginFill", [0x000000, 100]).chain(this.borderA_mc, "lineTo", [0, 0]).chain(this.borderA_mc, "lineTo", [550, 0]).chain(this.borderA_mc, "lineTo", [550, 400]).chain(this.borderA_mc, "lineTo", [0, 400]).chain(this.borderA_mc, "lineTo", [0, 0]).chain(this.borderA_mc, "endFill", []).chain(this.borderB_mc, "lineStyle", [1, 0x000000, 0]).chain(this.borderB_mc, "beginFill", [0x000000, 100]).chain(this.borderB_mc, "lineTo", [0, 0]).chain(this.borderB_mc, "lineTo", [550, 0]).chain(this.borderB_mc, "lineTo", [550, 400]).chain(this.borderB_mc, "lineTo", [0, 400]).chain(this.borderB_mc, "lineTo", [0, 0]).chain(this.borderB_mc, "endFill", []).chain(this.starburst_mc, "lineStyle", [1, 0x000000, 0]).chain(this.starburst_mc, "beginFill", [0xFF5217, 100]).chain(this.starburst_mc, "lineTo", [-33, -364]).chain(this.starburst_mc, "lineTo", [9, -64]).chain(this.starburst_mc, "lineTo", [28, -60]).chain(this.starburst_mc, "lineTo", [98, -361]).chain(this.starburst_mc, "lineTo", [195, -326]).chain(this.starburst_mc, "lineTo", [40, -54]).chain(this.starburst_mc, "lineTo", [50, -44]).chain(this.starburst_mc, "lineTo", [278, -270]).chain(this.starburst_mc, "lineTo", [323, -223]).chain(this.starburst_mc, "lineTo", [63, -33]).chain(this.starburst_mc, "lineTo", [68, -19]).chain(this.starburst_mc, "lineTo", [400, -62]).chain(this.starburst_mc, "lineTo", [407, 33]).chain(this.starburst_mc, "lineTo", [72, 2]).chain(this.starburst_mc, "lineTo", [68, 28]).chain(this.starburst_mc, "lineTo", [394, 129]).chain(this.starburst_mc, "lineTo", [329, 258]).chain(this.starburst_mc, "lineTo", [58, 49]).chain(this.starburst_mc, "lineTo", [47, 60]).chain(this.starburst_mc, "lineTo", [245, 341]).chain(this.starburst_mc, "lineTo", [148, 392]).chain(this.starburst_mc, "lineTo", [30, 71]).chain(this.starburst_mc, "lineTo", [18, 74]).chain(this.starburst_mc, "lineTo", [79, 407]).chain(this.starburst_mc, "lineTo", [3, 411]).chain(this.starburst_mc, "lineTo", [0, 75]).chain(this.starburst_mc, "lineTo", [-7, 77]).chain(this.starburst_mc, "lineTo", [-62, 407]).chain(this.starburst_mc, "lineTo", [-162, 371]).chain(this.starburst_mc, "lineTo", [-23, 73]).chain(this.starburst_mc, "lineTo", [-38, 64]).chain(this.starburst_mc, "lineTo", [-221, 331]).chain(this.starburst_mc, "lineTo", [-281, 275]).chain(this.starburst_mc, "lineTo", [-53, 48]).chain(this.starburst_mc, "lineTo", [-63, 27]).chain(this.starburst_mc, "lineTo", [-350, 158]).chain(this.starburst_mc, "lineTo", [-372, 50]).chain(this.starburst_mc, "lineTo", [-67, 9]).chain(this.starburst_mc, "lineTo", [-67, -9]).chain(this.starburst_mc, "lineTo", [-367, -51]).chain(this.starburst_mc, "lineTo", [-349, -112]).chain(this.starburst_mc, "lineTo", [-62, -24]).chain(this.starburst_mc, "lineTo", [-49, -42]).chain(this.starburst_mc, "lineTo", [-259, -253]).chain(this.starburst_mc, "lineTo", [-190, -309]).chain(this.starburst_mc, "lineTo", [-33, -54]).chain(this.starburst_mc, "lineTo", [-8, -63]).chain(this.starburst_mc, "lineTo", [-102, -351]).chain(this.starburst_mc, "lineTo", [-33, -365]).chain(this.starburst_mc, "endFill", []).chain(this.starburst_mc, "applyProps", [{_x:260, _y:190, filters:[dropShadowC]}]).chain(this.borderA_mc, "applyProps", [{filters:[dropShadowD]}]).chain(this.borderB_mc, "applyProps", [{filters:[dropShadowE]}]);
for (var c:Number = 0; c<20; c++) {
chain(circleHolder_mc, "createEmptyMovieClip", ["circle"+c+"_mc", c]).chain(this, "applyProps", [{radius:5+random(25)}]);
this.circleHolder_mc["circle"+c+"_mc"].move = function():Void {
this._parent._parent.chain(this, "applyProps", [{_visible:(this._y<(0-this.radius)) ? false : true, ys:(this._y>400-this.radius*2) ? (Math.max((20+random(5))*-1, this.ys*-1)) : this.ys+1, _y:(this._y>400-(this.radius*2)) ? (this._y-this.ys-this.radius*2)-(this._y-(400)) : this._y+this.ys, xs:(this._x<0+this.radius || this._x>550-this.radius) ? this.xs*-1 : this.xs, _x:(this._x<0+this.radius) ? (this._x-(this._x-(0+this.radius)))-this.xs : (this._x>550-this.radius) ? (this._x-(this._x-(550-this.radius)))-this.xs : this._x+this.xs}]);
};
chain(this.circleHolder_mc["circle"+c+"_mc"], "applyProps", [{_x:100+random(300), _y:random(100), ys:(random(11)*-1), xs:(random(11)-5), radius:this.radius}]).chain(this.circleHolder_mc["circle"+c+"_mc"], "lineStyle", [this.radius*2, 0xFF66FF, 100]).chain(this.circleHolder_mc["circle"+c+"_mc"], "moveTo", [0, 0]).chain(this.circleHolder_mc["circle"+c+"_mc"], "lineTo", [0.2, 0]).chain(circleHolder_mc, "applyProps", [{filters:[dropShadowA, dropShadowB]}]).chain(this, "createInterval", [this.circleHolder_mc["circle"+c+"_mc"], "move", 30]);
}
Stage.scaleMode = "noScale";