Copy link to clipboard
Copied
I have a matching game that sets up a grid in code for the icons, and I want to add a border of some sort around the grid. How would I do so? Here is the code that sets up the grid:
public function startMatchThree() {
// create grid array
grid = new Array();
for(var gridrows:int=0;gridrows<8;gridrows++) {
grid.push(new Array());
}
setUpGrid();
isDropping = false;
isSwapping = false;
gameScore = 0;
addEventListener(Event.ENTER_FRAME,movePieces);
}
public function setUpGrid() {
// loop until valid starting grid
while (true) {
// create sprite
gameSprite = new Sprite();
// add 64 random pieces
for(var col:int=0;col<8;col++) {
for(var row:int=0;row<8;row++) {
addPiece(col,row);
}
}
Copy link to clipboard
Copied
You can use the Rectangle class to draw a rectangle. Check out the documentation and examples via the following link...
Rectangle - Adobe ActionScript® 3 (AS3 ) API Reference
Also, try looking thru Google searching AS3 Draw Border. There are a few different approaches you might take, from drawing lines to adding a glow filter.
https://www.google.com/search?client=firefox-b-1&q=AS3+draw+border
Find more inspiration, events, and resources on the new Adobe Community
Explore Now