Changes to `TileArray` API in OpenFL 6.1

OpenFL 6.1 is released, and includes an updated API for TileArray, as was added in OpenFL 6.0.

The beta TileArray API has been given the ability to be iterated over in a loop. I think this will help reduce errors that could be caused by not setting tileArray.position properly.

It also now shares a ITile interface with the standard Tile class, which should help keep things more consistent, and arguably makes TileArray easier to use:

var tileArray = tilemap.getTiles ();
for (tile in tileArray) {
    var matrix = tile.matrix;
    matrix.tx = 100;
    matrix.ty = 100;
    tile.matrix = matrix;
    tile.alpha = 0.5;
tilemap.setTiles (tileArray);

If you have used drawTiles in the past, or still have code to port, the TileArray API should be easier to use than the standard Tilemap API. The bonus, too, is that you do not have to remember the data array order :stuck_out_tongue:

Thank you for your feedback, and have a great day :grin:

1 Like