Revision: 7308
Updated Code
at July 18, 2008 14:28 by taboularasa
Updated Code
private function generateBoard(startX:Number,startY:Number,totalRows:Number,totalCols:Number,buttonSize:Number):void { buttons = new Array(); var colCounter:uint; var rowCounter:uint; for(rowCounter = 0; rowCounter < totalRows; rowCounter++) { for(colCounter = 0; colCounter < totalCols; colCounter++) { var b:Button = new Button(); b.x = startX + (colCounter*buttonSize); b.y = startY + (rowCounter*buttonSize); b.addEventListener(MouseEvent.CLICK, letterClicked); b.label = getRandomLetter().toUpperCase(); b.setSize(buttonSize,buttonSize); b.name = "buttonRow"+rowCounter+"Col"+colCounter; addChild(b); buttons.push(b); } } }
Revision: 7307
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 17, 2008 15:31 by taboularasa
Initial Code
private function generateBoard(startX:Number,startY:Number,totalRows:Number,totalCols:Number,buttonSize:Number):void { buttons = new Array(); var colCounter:uint; var rowCounter:uint; for(rowCounter = 0; rowCounter < totalRows; rowCounter++) { for(colCounter = 0; colCounter < totalCols; colCounter++) { var b:Button = new Button(); b.x = startX + (colCounter*buttonSize); b.y = startY + (rowCounter*buttonSize); b.addEventListener(MouseEvent.CLICK, letterClicked); b.label = getRandomLetter().toUpperCase(); b.setSize(buttonSize,buttonSize); b.name = "buttonRow"+rowCounter+"Col"+colCounter; addChild(b); buttons.push(b); } } }
Initial URL
Initial Description
Initial Title
AS3: Create a grid of bottons
Initial Tags
textmate, function
Initial Language
ActionScript 3