if this is my whole code and only button1 is clicked… then i sit for a few minutes, the garbage collecter should dump the Truckright?
var truck:MovieClip= new Truck();
this.addChild(truck);
stage.addEventListener(MouseEvent.CLICK, clicked);
function clicked(e:MouseEvent)
{
if (e.target == button1)
{
this.removeChild(truck);
truck = null;
}
else if (e.target==button2)
{
var newtruck:MovieClip= new Truck();
addChild(newtruck);
}
}
- am i doing something wrong with that…
2)air for android with gpu mode blits instances of the same Display Objects from 1 source of that object type. (including movieClips and their timelines, yey)
Of course this example creates 1 truck right away, but if i wait for the app to start for a bit, add a first time instance of a display object, you can clearly see fps dip for a sec as it writes the first one to memory as expected, all future instances are fast as its automatically blitting from that pixel buffer created for the Truck object
So here’s my issue:
Click button1 …wait a while
Click button2 , the item is instant, telling me the pixel buffer written by the first Truck is still alive and well.
So as i asked before, am i doing what is needed for gc, and if so, how would i dump the pixel buffer to free up ram?
[edit]
assuming a movieClip in library exported as “Truck”
and 2 buttons sitting on stage