Ah... I see I replied too early on the original thread (without reading this one first). You should still investigate the externalInterface methodology as if I was wearing my Flash developer hat, this would be the preferred implemetation over adding/removing.
Aran On Thu, Jun 18, 2009 at 7:34 AM, Tomizechsterson <[email protected]>wrote: > > Wow, that's a sweet solution. I really appreciate the response, and > sorry about putting in the wrong subject. I just saw the memory usage > on the iexplore.exe process skyrocketing while I was using the > swfobject, so naturally I start panicking. This method does work > well, thanks! > > On Jun 17, 1:02 pm, "Getify Solutions, Inc." <[email protected]> wrote: > > First of all, I believe based on what you wrote that the subject is > > misleading, as you're not really describing a "memory" leak situation. So > > I've changed this thread subject to be more on target with your question. > > > > Second, to address your question... There is no underlying "div" to > > preserve, because once you target a div with embedSWF, the div is > > *replaced*, not appended to. This means that the only way to remove the > swf > > from the DOM is to completely remove it, which has the destructive effect > of > > now having removed any trace of what you originally targeted and > replaced. > > > > Most people who ask this question, in regards to cycling through > > embedSWF()/removeSWF() repetitions, find it easiest to instead have a > > container div that you drop placeholder divs into on-the-fly before > calling > > embedSWF to replace them with an OBJECT. > > > > So, for instance: > > > > <script> > > function recycleSWF(swfID) { > > swfobject.removeSWF(swfID); > > $("<div></div>").attr("id",swfID).appendTo("#myholder"); // jquery > > used for simplicity sake, can be done a number of ways > > swfobject.embedSWF("my.swf",swfID,...);} > > > > ... > > // on some event, like a button click: > > recycleSWF("myobj"); > > ... > > </script> > > > > <body> > > <div id="myholder"> <!-- will get continually get a div placeholder > thrown > > into it and then replaced by the SWF --> </div> > > </body> > > > > This method should work pretty solidly for you, and shouldn't have any > > memory leak issues. Just take slight extra care to make sure your CSS > > accounts for an extra container div around your swf elements. > > > > --Kyle > > > > -------------------------------------------------- > > From: "Tomizechsterson" <[email protected]> > > Sent: Wednesday, June 17, 2009 2:38 PM > > To: "SWFObject" <[email protected]> > > Subject: memory leak in IE7 with swfobject 2.2 > > > > > > > > > > > > > > > > > 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 -~----------~----~----~----~------~----~------~--~---
