removeSWF() takes more than createSWF() created #28

Open
cybear opened this Issue Feb 3, 2014 · 1 comment

Projects

None yet

2 participants

@cybear
cybear commented Feb 3, 2014

The constructor and destructor methods are not in sync.

Steps to reproduce:
I give the container element ID to the create function:

swfobject.createSWF(attrObj, parObj,'swf_container');

(swf_container is the ID of an element which is already in the DOM)

Now when I call the destructor function

swfobject.removeSWF('swf_container');

It not only removes the Flash file from the DOM but also the container 'swf_container'.

What's the problem?
This inconsistency is a problem to me, because I am replacing one Flash file with another one at a certain time. As of now I've made a wrapper destructor outside of swfobj that does the same but adds back an element to the DOM.

this.removeSWF = function(elementId){
      var swfParent = document.getElementById(elementId).parentNode;
      swfobject.removeSWF(elementId);
      swfParent.innerHTML = '<div id="'+elementId+'"></div>';
}

I'd love it if swfobj would behave in a more expected manner though.

@mhenrixon

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment