Sign in to follow this  
forth

[web] [Flash-AS3] one image load, multiple uses

Recommended Posts

My friends and I have decided to try to make a game for flash player 9 in AS3. Since it'll be a real-time tiled strategy game, we will have the same tiles used(rendered) on different map locations. If we were to load the same tile over and over again for each map render this would eat up a lot of memory. So, now I'm asking, if there's a way to load the tile(bitmap) once and then, when I want to render it 100 times, I'd just referenced to it, instead of loading it again? Thanks!

Share this post


Link to post
Share on other sites
Once loaded, make multiple bitmapData objects, and then do bitmapData.draw(myImage).

Or, you could create a Shape(), and then do a myShape.graphics.beginBitmapFill(myImage), but you might first have to draw myImage to a BitmapData object, and then myShape.graphics.beginBitmapFill(myBitmapData);

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this