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

Fast Checker Board Pattern

Get Adobe Flash player
by xor 15 Oct 2011
    Embed
package
{
	import flash.display.Sprite;
	
	public class FlashTest extends Sprite
	{
		public function FlashTest()
		{
			// http://www.purplesquirrels.com.au/?p=1283
			var even:uint = 0xCCCCCC;
			var odd:uint = 0x999999;
			var size:int = 10;
			var nH:int = stage.stageWidth / size;
			var nV:int = stage.stageHeight / size;
			var clr:uint;
			var i:uint;
			var j:uint;
			for (i = 0; i < nV; ++i)
			{
				// Flip values of Even and Odd colours using Bitwise operations
				even ^= odd;
				odd ^= even;
				even ^= odd;
				
				// loop horizontal
				for (j = 0; j < nH; ++j)
				{
					//bitwise modulus
					//check if column is odd or even, then set colour
					clr = j & 1 ? even : odd;
					
					// draw box with previously set colour
					graphics.beginFill(clr, 1);
					graphics.drawRect(Number(j * size), Number(i * size), size, size);
					graphics.endFill();
				}
			}
		
		}
	}
}