First off I just want to say I’m new to this forum. I’ve searched through the posts and nothing out there currently has helped me solve my problem, and all Google searching has given me naught but a headache.
Before getting to the problem itself, here is some basic info about my app:
It moves through states. For simplicity’s sake we will say it goes through Idle, Instructions, Playing, and GameOver (it actually has more but they aren’t really important).
Everything that gets created in this app is only created once. I am not removing anything at any time or re-creating anything. Everything is re-used each time through the loop.
I am using Mr. Doob’s stats profiler to view my memory usage.
I am using external libraries, but for purposes of debugging this problem I have omitted them and put everything in my main Fla.
So basically, every time my game finishes one complete loop through its states, I’m gaining up to 1 MB of memory. This app needs to be able to run continuously without crashing, and with that sort of memory increase at this early stage of development it puts me in a predicament.
I have narrowed it down to the Playing state. I have 35 images that are being loaded into a class (which I will call Icon here).
This is a stripped down version of its constructor (Icon extends Sprite):
public function Icon($mc_className:String)
{
_fallSpeed = 100;
var iconClass:Class = getDefinitionByName($mc_className) as Class;
var iconBitmap:Bitmap = new Bitmap(new iconClass());
addChild(iconBitmap);
}
Every frame, I call this method on it:
public function onTick($elapsedTime:Number):void
{
y += _fallSpeed * $elapsedTime; // elapsedTime is in seconds
}
The playing state has its own container. This container is added and removed to the stage, but everything within it is simply moved around (only added once).
I hope I provided enough details. I am not at liberty to post all of the code. Any help with this matter would be appreciated.
I am probably wrong, but I speculate that the problem is something to do with drawing those bitmaps as they are falling.