CLICK HERE TO COPY
Actionscript:
var cmds:Array = [["lineStyle", 0, 0xFF0000], ["drawCircle",100, 100, 50], ["drawRect", 50, 50, 100, 100]];
cmds.push(["drawCircle", 100, 100, 70]);
cmds.push(["beginFill", 0x555555]);
cmds.push(["drawRoundRect", 80, 80, 40, 40, 10, 10]);
cmds.push(["endFill"]);
render(cmds);
function render(p:Array):void {
for (var i:int = 0; i<p.length; i++) {
graphics[p[i][0]].apply(graphics,p[i].splice(1));
}
}
The above creates a function called render() that takes a 2D array [...]