[flexcoders] Re: Local Connection - RESOLVED!

2006-07-27 Thread flexnewbie06
Thanks again jesterXL...

Added just a few lines...can't believe i didn't think of this 
earlier...it was definitly a light bulb moment...cleans up local 
connection...so it can be used by next loaded swf.  Had to make 
changes to swf's and just wasn't thinking about them.

added - to main flex app every time swfLoader changes it's source...
lc.send (_swfConnect, killAll);

added - to the main.swf's called functions
lc.killAll = function () {
lc.close()
}

okay...what's next...;o)

--- In flexcoders@yahoogroups.com, 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: flexcoders@yahoogroups.com
 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 flexcoders@yahoogroups.com, 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: flexcoders@yahoogroups.com
  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 flexcoders@yahoogroups.com, 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: flexcoders@yahoogroups.com
   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 flexcoders@yahoogroups.com, JesterXL jesterxl@ wrote:
   
Can you paste a snippet of your LocalConnection code in the
 Flash
   SWF?
   
- Original Message - 
From: flexnewbie06 flexnewbie06@
To: flexcoders@yahoogroups.com
Sent: Wednesday, July 26, 2006 

Re: [flexcoders] Re: Local Connection - RESOLVED!

2006-07-27 Thread JesterXL
Delete the ho!

after close:

lc = null;
delete lc;

- Original Message - 
From: flexnewbie06 [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Thursday, July 27, 2006 10:11 AM
Subject: [flexcoders] Re: Local Connection - RESOLVED!


Thanks again jesterXL...

Added just a few lines...can't believe i didn't think of this 
earlier...it was definitly a light bulb moment...cleans up local 
connection...so it can be used by next loaded swf.  Had to make 
changes to swf's and just wasn't thinking about them.

added - to main flex app every time swfLoader changes it's source...
lc.send (_swfConnect, killAll);

added - to the main.swf's called functions
lc.killAll = function () {
lc.close()
}

okay...what's next...;o)

--- In flexcoders@yahoogroups.com, 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: flexcoders@yahoogroups.com
 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 flexcoders@yahoogroups.com, 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: flexcoders@yahoogroups.com
  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 flexcoders@yahoogroups.com, 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: flexcoders@yahoogroups.com
   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 flexcoders@yahoogroups.com, JesterXL jesterxl

[flexcoders] Re: Local Connection - RESOLVED!

2006-07-27 Thread flexnewbie06
..works perfect.


--- In flexcoders@yahoogroups.com, JesterXL [EMAIL PROTECTED] wrote:

 Delete the ho!
 
 after close:
 
 lc = null;
 delete lc;
 
 - Original Message - 
 From: flexnewbie06 [EMAIL PROTECTED]
 To: flexcoders@yahoogroups.com
 Sent: Thursday, July 27, 2006 10:11 AM
 Subject: [flexcoders] Re: Local Connection - RESOLVED!
 
 
 Thanks again jesterXL...
 
 Added just a few lines...can't believe i didn't think of this 
 earlier...it was definitly a light bulb moment...cleans up local 
 connection...so it can be used by next loaded swf.  Had to make 
 changes to swf's and just wasn't thinking about them.
 
 added - to main flex app every time swfLoader changes it's source...
 lc.send (_swfConnect, killAll);
 
 added - to the main.swf's called functions
 lc.killAll = function () {
 lc.close()
 }
 
 okay...what's next...;o)
 
 --- In flexcoders@yahoogroups.com, JesterXL jesterxl@ 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 flexnewbie06@
  To: flexcoders@yahoogroups.com
  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 flexcoders@yahoogroups.com, 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: flexcoders@yahoogroups.com
   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 flexcoders@yahoogroups.com, 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: flexcoders@yahoogroups.com
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

Re: [flexcoders] Re: Local Connection - RESOLVED!

2006-07-27 Thread JesterXL
w00t!  GC got PWND!!!.

- Original Message - 
From: flexnewbie06 [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Thursday, July 27, 2006 10:48 AM
Subject: [flexcoders] Re: Local Connection - RESOLVED!


..works perfect.


--- In flexcoders@yahoogroups.com, JesterXL [EMAIL PROTECTED] wrote:

 Delete the ho!
 
 after close:
 
 lc = null;
 delete lc;
 
 - Original Message - 
 From: flexnewbie06 [EMAIL PROTECTED]
 To: flexcoders@yahoogroups.com
 Sent: Thursday, July 27, 2006 10:11 AM
 Subject: [flexcoders] Re: Local Connection - RESOLVED!
 
 
 Thanks again jesterXL...
 
 Added just a few lines...can't believe i didn't think of this 
 earlier...it was definitly a light bulb moment...cleans up local 
 connection...so it can be used by next loaded swf.  Had to make 
 changes to swf's and just wasn't thinking about them.
 
 added - to main flex app every time swfLoader changes it's source...
 lc.send (_swfConnect, killAll);
 
 added - to the main.swf's called functions
 lc.killAll = function () {
 lc.close()
 }
 
 okay...what's next...;o)
 
 --- In flexcoders@yahoogroups.com, JesterXL jesterxl@ 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 flexnewbie06@
  To: flexcoders@yahoogroups.com
  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 flexcoders@yahoogroups.com, 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: flexcoders@yahoogroups.com
   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 flexcoders@yahoogroups.com, 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: flexcoders@yahoogroups.com
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