Skip to main content
January 27, 2014
Question

How to use tile map with AS3?

  • January 27, 2014
  • 1 reply
  • 1108 views

I have a file that contains a bunch of isometric tiles that I need to make a map with, much like a sprite sheet but not for making animations. So using AS3, how can I divide that file into the different tiles, knowing the coordinates of each of them. Or can it be done automatically in Flash itself, so I can access each tile from AS3?

Furthermore I've been a programmer for a couple of decades but I am new to Flash. I know there are a ton of DisplayObjects like Bitmap, Sprite, Shape, MovieClip, Symbol etc. But which one would be better to use for that file? I need to access it from AS3 as described above, but I don't need it to react to mouse events, stretch or have children, just extract each tile and move it onto the stage with AS3.

It seems to be down to a choice between Bitmap and Shape, since they're both lightweight, but I couldn't find out what the advantages and disadvantages of them are, as there was no comparison between those two on Google, though between a lot of the other objects. And Symbol seems like an idea too, since when I googled this, I found a lot of pages saying that you should convert a Bitmap to a Symbol, but I never found out why.

Oh, and since I'm building an isometric map, all the tiles and all other graphics I'll be using, will be Bitmap and not Vector since I'm drawing the graphics in pixelart.

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
January 27, 2014

create one tile symbol (movieclip or sprite so you can use actionscript to reference tile properties - like its x and y) and arrange them (using code or by hand) into your map.

enable the cacheAsBitmap property of your map (that has some number of tile children).

assign the mouseEnabled property of the map to false and its mouseChildren property to false.