By Zevan | December 12, 2008
CLICK HERE TO COPY
Actionscript:
var col:int, i:int, j:int, s:int = 500, div:Number =20, outcoord:Point = new Point(), points:Vector.<Point> = new Vector.<Point>();
for (i = 0; i<5; i++) points.push(new Point(int(Math.random()*s),int(Math.random()*s)));
var canvas:Bitmap = Bitmap(addChild(new Bitmap(new BitmapData(s,s, false, 0xFF0000), "auto", true)));
for (i = 0; i<canvas.width * canvas.height; i++){
outcoord= new Point( i % canvas.width, i / canvas.width);
col [...]
By Zevan | December 11, 2008
CLICK HERE TO COPY
Actionscript:
for (var i:int = 1; i<26; i++) with(addChild(new TextField())) x = 10, y = i * 10, text = "line" + i;
code will create 25 TextFields that say "line1", "line2", "line3" etc...
If you don't already know, Keith Peters has started up the 25 line actionscript contest again... The first round of [...]
Posted in misc | Tagged actionscript, flash |
By Zevan | December 9, 2008
CLICK HERE TO COPY
Actionscript:
var map:Vector.<Vector.<int>> = new Vector.<Vector.<int>>();
map[0] = new Vector.<int>();
map[0].push(1);
map[0].push(0);
map[0].push(0);
map[1] = new Vector.<int>();
map[1].push(0);
map[1].push(1);
map[1].push(0);
map[2] = new Vector.<int>();
map[2].push(0);
map[2].push(0);
map[2].push(1);
/*
map:
1,0,0
0,1,0
0,0,1
*/
This creates a two dimensional Vector of ints (flash 10 player only). The first line is the real snippet... took me a few minutes to get the syntax right the first time I needed a 2D Vector.