Effective way to update XMLListCollection

CabeelalsEfep

New Member
I have the following code:\[code\]private var xmlC:XMLListCollection = new XMLListCollection();private var httpS:HTTPService = new HTTPService();private var timer:Timer = new Timer(1000);private var xmlData:XML;private var xmlDataList:XMLList;protected function application1_creationCompleteHandler(event:FlexEvent):void{ httpS.url = "data.xml"; httpS.addEventListener(ResultEvent.RESULT, resultHTTP); httpS.resultFormat="e4x"; httpS.send(); timer.start(); timer.addEventListener(TimerEvent.TIMER, updateXMLC);}private function updateXMLC(event:TimerEvent):void{ xmlC.source = xmlDataList; httpS.send();}private function resultHTTP(event:ResultEvent):void{ xmlData = http://stackoverflow.com/questions/11328425/event.result as XML; xmlDataList = xmlData.dg.rows.row;}\[/code\]"data.xml" have 5000 lines, so I need to clean its traces whenever necessary. I have two problems that I found thanks to the profiling[*]Every time httpS.send() is called in the method updateXMLC, it calls URLLoader internally which keeps XML that is not needed anymore wandering in the memory without being garbage collected[*]is there a more effective way to update xmlC, whenever the XMLListCollection is updated, it seems that the previous value of XMLListCollection doesn't get garbage collected
 
Back
Top