I have buttons to change the current level which makes tiles load up such as 2x2 or 3x3, 5x5 ect. As they do not remove once they are made eg, it leaves the 5x5 set of tiles if i click back to a 2x2 map.
btnRem.addEventListener(MouseEvent.CLICK, removeMiniMap);
function removeMiniMap(e:MouseEvent) {
btnRem.removeEventListener(MouseEvent.CLICK, removeMiniMap);
stage.removeChild(MiniMap);
}
Seems simple enough and it works if i manually click the button and it works exactly how i want it to (Removes all the MiniMap tiles). However by removing the MouseEvent and making it a function call it stops the new level being drawn but keeps the old tiles present.
removeMiniMap()
function removeMiniMap() {
stage.removeChild(MiniMap);
}
Edit: Seems i have more then one instance of MovieClip being made. when i add a trace after i removed it and then remake it the trace returns for however many times i have made the object.
I will need to keep looking but i do not know how to properly unload it seems.