As an as3 expert here are my ideas howyou could improve your code:
1) Use weakly referenced listeners.
useinstead ofCode:loader.addEventListener(MouseEvent.CLICK, clickHandler, false, 0, true );
and for any other addEventListener.Code:loader.addEventListener(MouseEvent.CLICK, clickHandler);
2) Try to add this code:
// force immediate garbage collection - see grant skinner's article at
// http://www.gskinner.com/blog/archive...urce_ma_2.html
and see if the memory drops. You should better watch the memory, one load after another.Code:try { new LocalConnection().connect('foo'); new LocalConnection().connect('foo'); } catch (e:*) {}
3) Remove event listeners on what you added: loader.addEventListener(MouseEvent.CLICK, clickHandler);




Reply With Quote