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" <[EMAIL PROTECTED]> wrote: > > Try again, but put an underscore in front of the name for both SWF's. > > "_swfConnect" instead of "swfConnect". > > > ----- Original Message ----- > From: "flexnewbie06" <[EMAIL PROTECTED]> > 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 > ------------------------ Yahoo! Groups Sponsor --------------------~--> Great things are happening at Yahoo! Groups. See the new email design. http://us.click.yahoo.com/SktRrD/hOaOAA/yQLSAA/nhFolB/TM --------------------------------------------------------------------~-> -- 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/

