i have 3 flvs, that are rather big in dimension, that im using as backgrounds. when i use any of these flvs my movie works fine but when i switch to a new background my movie takes a big hit in performace. im guessing this has something to do with the garbage collection in as3 because i explicitly get rid of the old background. what is the best way to cycle through multiple flvs without loosing performance?
heres code im using to switch backgrounds
removeChild(theBackground);
theBackground = null;
theBackground = assetLoader.getBackground(level);
addChildAt(theBackground,1);
and heres code im using to play flvs
public function populate():void{
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
var vid:Video = new Video(1224,840);
this.addChild(vid);
vid.attachNetStream(ns);
ns.play("bg2Blue.flv");
ns.addEventListener(NetStatusEvent.NET_STATUS, netstat);
function netstat(stats:NetStatusEvent){
trace(stats.info.code);
}
var netClient:Object = new Object();
netClient.onMetaData = function(meta:Object){
trace(meta.duration);
};
ns.client = netClient;
trace("populated.");
}