@Tomizechsterson How does having a method which removes a DOM element = a memory leak exactly? From your message all I see is that you want to know of a way to easily (re)add a swf to a page which is already loaded.
If you call removeSWF(), then it clears the object from the DOM / memory. You can recreate a DOM element div and then call embedSWF() again. A tutorial which demonstrates what you are after can be found here: http://pipwerks.com/lab/swfobject/load-onclick/2.0/index.html (see section titled "Using an 'onclick' event to replace a loaded SWF with another SWF") That being said, it seems awfully wasteful to unload / reload the entire swf just to point to a new image to load/zoom. I would suggest you re-examine the architecture of your swf. You could easily expose some externalInterface methods on your swf which you could invoke from javascript to push a new image path etc without having to unload the swf from the browser. Please don't falsely state that SWFObject has a bug such as a memory leak unless you can actually demonstrate an actual valid usecase. Aran On Thu, Jun 18, 2009 at 5:38 AM, Tomizechsterson <[email protected]>wrote: > > It seems like there's still something not right about the way this > object handles memory. Our web app uses swfobject to display a flash > module that allows the user to view an image and manipulate it with > pan, zoom, etc. The way this works is by calling swfobject.embedSWF, > getting the object with swfobject.getObjectById, and calling a > function within that returned object passing in the url of the image > to display. > > There doesn't appear to be any function to call that can clear the > swfobject from memory, and allow it to be recreated again later. > swfobject.removeSWF appears to eliminate the div that houses it > entirely, making any subsequent calls to swfobject.embedSWF have no > effect, which in turn makes the object returned from > swfobject.getObjectById return a null object. > > Would there be a way to add functionality to swfobject to dispose of > it, but keep the underlying div element intact, to allow for re- > embedding? Unless there's another way to do this, which I'm foolishly > missing, of course.. > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "SWFObject" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/swfobject?hl=en -~----------~----~----~----~------~----~------~--~---
