Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>_board is a multidimensional array filled first with Arrays. In the BoardDisplay.mxml</p> <p><strong>(Hello! Flex 4 : Chapter 3. Hello Spark: primitives, comp... > FXG and MXML graphics—building a game.. - Pg. 80)</strong> , </p> <pre><code>&lt;Graphic version="1.0" viewHeight="601" viewWidth="701" xmlns=" library://ns. adobe. com/flex/spark" xmlns:fx=" http://ns. adobe. com/mxml/2009" xmlns:mx=" library://ns. adobe. com/flex/halo" initialize="createBoard()" click=" clickHandler(event)"&gt; </code></pre> <p>initialize calls createBoard().</p> <pre><code>private function createBoard():void { newGame(); _board = new Array(6); for (var row:int = 0; row &lt; 6; row++) { _board[row] = new Array(7); for (var col:int = 0; col &lt; 7; col++) { _board[row][col] = addEllipse(row, col); //Magic Happens! } } } </code></pre> <p>addEllipse returns Ellipse to each entry in _board</p> <pre><code>private function addEllipse(row:int, col:int):Ellipse { var ellipse:Ellipse = new Ellipse(); ellipse.x = 4 + col*100; ellipse.y = 5 + row*100; ellipse.width = 90; ellipse.height = 90; ellipse.fill = getFill(row,col); // Magic Found ! ellipse.stroke = new SolidColorStroke(0x000000, 1, 1.0, false,"normal", null, "miter", 4); boardGroup.addElement(ellipse); return ellipse; } </code></pre> <p>The author casted it as maxmx said but did not really need to as all the entries were of type Ellipse so</p> <pre><code>Ellipse(_board[row][column]).fill = getFill(row, column); </code></pre> <p>can work as</p> <pre><code>_board[row][column].fill = getFill(row, column); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload