Ok, heres a sketch of what im trying now. App.mxml ==== <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="initApp()"> <mx:Script> <![CDATA[ import mx.managers.PopUpManager; import mx.managers.PopUpManagerChildList; import mx.core.IFlexDisplayObject; private var screenDict:Dictionary; private var scr1:IFlexDisplayObject; private function initApp():void{ screenDict = new Dictionary(true); } public function createScreen (parent:DisplayObjectContainer, screen:Class,modal:Boolean=false):IFlexDisplayObject{ var s:IFlexDisplayObject = PopUpManager.createPopUp(parent, screen, modal,PopUpManagerChildList.APPLICATION); screenDict[s] = s.name return s; } public function showObjects():void{ trace(new Date()); for (var i:* in screenDict){ trace(i+":"+screenDict[i]); } } public function removeScreen (screen:IFlexDisplayObject):void{ PopUpManager.removePopUp(screen); } private function makeScreen():void{ if(scr1 == null){ scr1 = createScreen (this,Testing,false); } } private function destroyScreen():void{ removeScreen(scr1); scr1 = null; } ]]> </mx:Script> <mx:Button click="makeScreen()" label="make"/> <mx:Button click="destroyScreen()" label="kill"/> <mx:Button click="showObjects()" label="show"/> </mx:Application>
Testing.mxml ===== <?xml version="1.0" encoding="utf-8"?> <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300"> <mx:Button click="this.dispatchEvent(new Event('foo'))"/> </mx:Panel> Now, as i run this, if i click make, kill, make, kill, show, The trace shows: Wed Jul 26 17:07:14 GMT-0400 2006 Testing58:Testing58 Testing20:Testing20 Testing39:Testing39 Implying that the screens arent really being destroyed. Perhaps I didnt wait long enough, so 5 minutes later, I tried the same thing, with the same results. Maybe 5 minutes isnt long enough, so I'll leave it running over night and try again in the morning. But, the fundemental question is, have i done enough to remove the screens? Should the garbage collector clean the unused ones up, or have i somehow left a reference lingering? We have a very complex app, which I want to ensure we clean up all unused objects, but im having trouble finding a way to verify they are removed. -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

