Not a problem Angus,
I seem to remember seeing this as an issue somewhere. Streams are not killed when the application is unloaded.
Other than your possible solution, I am not aware of a workaround at this time.
 
Hilary
 
--

 
On 7/10/06, Angus Johnson <[EMAIL PROTECTED]> wrote:
Gotcha. Thanks Hilary.

I'm pretty happy with the way swf's are loading now. Looks like garbage collection destroys unused swf's after I made sure the references were deleted.

I still have an issue unloading swf's that are not movies but applications. For example, an application written by someone else which uses the sound class and streams music to the client. It continues to play even when unloaded and removed.

I guess the best way to deal with this is get other developers to implement a hook or interface which can be called by the parent application, something like onTerminate(). That method then tidies up the sub application and in this case closes the sound stream. Might need to spec out an interface or something similar.

Cheers
Angus

On 07/07/06, Hilary Bridel < [EMAIL PROTECTED]> wrote:

Hi Angus,
swfContent is a reference to the actual SWF file which is the child of Loader.
swfContent.loaderInfo.loader.unload() will remove the SWF file.
You are right to say that removeChild(myLoader) would completely remove the Loader, but in this case I need it to load the SWF again.
 
Hilary
 
--On 7/7/06, Angus Johnson <[EMAIL PROTECTED] > wrote:
Thank you both for the reply.

Hilary, your example has been very helpful. Correct me if I'm wrong (very likely) but even though you unload the swfContent wouldn't it still be in memory? From my very brief read up of garbage collection wouldn't it still exist unless you removed myLoader references, probably with myLoader = null, then removed it from the application with this.removeChild('myLoader')?

I'll keep on eye on that blog for future tips.

Cheers
 
Angus


On 07/07/06, Jeremy Lu < [EMAIL PROTECTED]> wrote:


Resource management and garbage collection is a lot different then it used to be, here's a great post on it (from Grant Skinner's blog):

http://www.gskinner.com/blog/archives/2006/07/as3_resource_ma_1.html

The point is, you should stop all playing sound, remove all listeners from EventDispatcher and nullified the Display Object or loaded swfs.

I believe in the years to come, this issue will be brought up again and again :-)

Jeremy.



On 7/6/06, Angus Johnson < [EMAIL PROTECTED] > wrote:

Hi,

I have a canvas called parentView into which I add SWF child objects via...

parentView.addChild(mySWF);
mySWF.load();

No problems loading. When I want to change the contents of parentView and swap out the loaded SWF I run...

parentView.removeAllChildren();
// get new mySWF
parentView.addChild(mySWF);
mySWF.load();

Now I have noticed that the previous SWF's don't seem to unload. I have an example that runs a sound clip and I can still hear that playing even if I have replaced mySWF content in the parent several times. I also noticed that flash memory usage continues to increase with each load so something is wrong. Debug correctly shows only one child loaded.

SWFLoader class does't have an unload() method. removeAllChildren() should work right?

Cheers
Angus







--
Hilary

--





--
Hilary

-- __._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to