This is a mystery area. Go back and find all of the references to an object and remove them before the object is eligible for disposal? That's a lot of work. In .Net, the GC constantly spins around looking for memory to clear. The objects are either automatically marked for disposal, when they go out of scope, or are manually marked for disposal. This goes for connections as well. I'm sure many of us are wondering how to limit CPU usage.
-TH --- In [email protected], "JesterXL" <[EMAIL PROTECTED]> wrote: > > Geez, definately sounds like the GC then, that's harsh. Um... uh... well, > the only thing I can think of beyond doing it dynamically like you said is > to ensure when you remove them that you kill all listeners, delete what you > can, disconnect what you can, etc. BEFORE destroying the SWFLoader. > > Good luck. > > ----- Original Message ----- > From: "flexnewbie06" <[EMAIL PROTECTED]> > To: <[email protected]> > Sent: Thursday, July 27, 2006 8:03 AM > Subject: [flexcoders] Re: Local Connection > > > Jester, I read the articles and fully understand what you meant... > > I load one swf and then try to load a second and even though I've > sent the first swf packing it's still in memory and listening to the > menu.swf's local connection calls because GC hasn't come along and > cleaned it up. > > Maybe if I get rid of the SWFLoader completely then try to create a > new one dynamically when the next swf is loaded that would work?? > I'll try it. > > Yes, the menu.swf is able to control the two main swf's outside of > Flex. If they are all running at the same time, the menu.swf will > control which ever main.swf was started first. Then if i close that > main.swf the other will just start working. That little experiment > just provides more evidence (and helps me get it)...that the first > swf is still "there" in Flex... > > Anyway, Thanks again...if you have any more suggestions...as always > appreciated. I'll keep working at it... > Jenn > > > > --- In [email protected], "JesterXL" <jesterxl@> wrote: > > > > Oh it's deeper than emptying a source reference. Welcome to the > dark side > > of ActionScript 3...... > > > > http://www.gskinner.com/blog/archives/2006/06/as3_resource_ma.html > > > > http://www.gskinner.com/blog/archives/2006/07/as3_resource_ma_1.html > > > > BTW, do your SWF's talk to eachother locally without Flex? > > > > ----- Original Message ----- > > From: "flexnewbie06" <flexnewbie06@> > > To: <[email protected]> > > Sent: Wednesday, July 26, 2006 3:13 PM > > Subject: [flexcoders] Re: Local Connection > > > > > > okay, thanks...that works for loading a swf at runtime if the > > SWFLoader has no assigned source. However, if the SWFLoader has an > > assigned source and you try to change it during runtime, then LC > > doesn't work anymore. > > > > That comes back to your last comment about garbage collection and > the > > original swf not being cleaned up before the new one is loaded, i > > tried to research what you meant but as far i could tell all I could > > do in flex was to set the SWFLoader source to ="" before loading the > > next swf. I could not find any "unload" methods. > > > > Thanks again for helping. > > > > > > --- In [email protected], "JesterXL" <jesterxl@> wrote: > > > > > > Try again, but put an underscore in front of the name for both > > SWF's. > > > > > > "_swfConnect" instead of "swfConnect". > > > > > > > > > ----- Original Message ----- > > > From: "flexnewbie06" <flexnewbie06@> > > > To: <[email protected]> > > > Sent: Wednesday, July 26, 2006 1:59 PM > > > Subject: [flexcoders] Re: Local Connection > > > > > > > > > Jester, > > > I have tried putting the local connection code in the main flex > app > > > and calling to the embedded SWF and this is the attempt at > creating > > a > > > second embedded swf (menu) to make the calls to the main > > SWF...either > > > way if the swf is loaded at runtime...local connection is a no go. > > > > > > Thanks > > > > > > *****This is my menu.swf local connection code... > > > > > > #include "mc_tween2.as" > > > stop(); > > > var lcsend:LocalConnection = new LocalConnection(); > > > play_btn.onRelease = function(){ > > > lcsend.send ("swfConnect", "playFile"); > > > } > > > stop_btn.onRelease = function () { > > > lcsend.send ("swfConnect", "stopandrestart"); > > > } > > > pause_btn.onRelease = function () { > > > lcsend.send ("swfConnect" , "pauseFile"); > > > } > > > > > > *****And this is the Main.swf local connection code > > > > > > var lc:LocalConnection = new LocalConnection(); > > > lc.pauseFile = function() { > > > stop(); > > > } > > > lc.resumeFile = function() { > > > play(); > > > } > > > lc.stopandrestart = function() { > > > gotoAndStop(1); > > > } > > > lc.playFile = function () { > > > gotoAndPlay(1); > > > } > > > lc.getframeNum = function () { > > > > > > } > > > lc.connect("swfConnect"); > > > > > > ******* > > > > > > > > > > > > > > > --- In [email protected], "JesterXL" <jesterxl@> wrote: > > > > > > > > Can you paste a snippet of your LocalConnection code in the > Flash > > > SWF? > > > > > > > > ----- Original Message ----- > > > > From: "flexnewbie06" <flexnewbie06@> > > > > To: <[email protected]> > > > > Sent: Wednesday, July 26, 2006 1:02 PM > > > > Subject: [flexcoders] Local Connection > > > > > > > > > > > > I think I am going to go crazy over this. I have tried this a > > few > > > > different ways and always ending with the same result...not > > working. > > > > > > > > I have 2 swf's loaded in my app with SWFLoader. They use local > > > > connection to talk to each other. If i run app with swfloader > > with > > > > no source and then dynamically set the swf source when something > > > > happens in the app, local connection doesn't work. If i load > the > > > swf > > > > in design the local connection works fine. For example Code 1 > > > doesn't > > > > work, Code 2 does...If you can lend a hand I would REALLY > > > appreciate > > > > it. > > > > > > > > Jenn > > > > > > > > ****************Code 1***************** > > > > <?xml version="1.0" encoding="utf-8"?> > > > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > > > > layout="absolute"> > > > > <mx:Script> > > > > <![CDATA[ > > > > public function load():void { > > > > mainswf.source = "file.swf"; > > > > } > > > > ]]> > > > > </mx:Script> > > > > <mx:Panel x="25" y="10" width="528" height="383" > > layout="absolute"> > > > > <mx:SWFLoader id="mainswf" x="10" y="10" width="467" > > height="271"/> > > > > <mx:ApplicationControlBar x="10" y="0" width="539" height="60"> > > > > <mx:SWFLoader id="menu" source="menu.swf" width="499" > > height="58"/> > > > > </mx:ApplicationControlBar> > > > > </mx:Panel> > > > > <mx:Button click="load()" id="loader" x="25" y="445" > > > label="Button"/> > > > > </mx:Application> > > > > > > > > > > > > **********Code 2*************** > > > > > > > > <?xml version="1.0" encoding="utf-8"?> > > > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > > > > layout="absolute"> > > > > <mx:Panel x="25" y="10" width="528" height="383" > > layout="absolute"> > > > > <mx:SWFLoader id="mainswf" source="file.swf" x="10" y="10" > > > > width="467" height="271"/> > > > > <mx:ApplicationControlBar x="10" y="0" width="539" height="60"> > > > > <mx:SWFLoader id="menu" source="menu.swf" width="499" > > height="58"/> > > > > </mx:ApplicationControlBar> > > > > </mx:Panel> > > > > <mx:Button click="load()" id="loader" x="25" y="445" > > > label="Button"/> > > > > </mx:Application> > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > 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 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > 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 > > > > > > > > > > > > > > > > > > > -- > > 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 > > > > > > > > > > -- > 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 > -- 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/

