rldjrsksl / flex-iframe

Automatically exported from code.google.com/p/flex-iframe
0 stars 0 forks source link

IFrame's/Divs never removed #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If you have a highly dynamic UI where things come and go, and if those 
things contain the IFrame Html component, the IFrames/Divs that are 
injected into the HTML are never removed.  

If you dynamically add in IFrame components, and then remove them, if you 
look in Firebug, you'll still see the Divs hanging around.

To remedy this I did the following:
1. Added this to IFrame.as:
        private static var FUNCTION_REMOVEIFRAME:String = 
            "document.insertScript = function ()" +
            "{ " +
                "if (document.removeIFrame==null)" + 
                "{" + 
                    "removeIFrame = function (frameID)" +
                    "{ " +
                        "var iFrameDiv = document.getElementById
(frameID);" +
                        "iFrameDiv.parentNode.removeChild(iFrameDiv);" +
                    "}" +
                "}" +
            "}";

2. In createChildren() added:  ExternalInterface.call
(FUNCTION_REMOVEIFRAME);

3. Added a dispose() method that can be called by whoever created the 
IFrame and in there I do the following:
ExternalInterface.call("removeIFrame", frameId);

Perhaps there is a more elegant way to do this (in removed from stage 
perhaps?), but I think you can see what I am getting at.

Similarly, the ExternalInterface.addCallback(frameId + "_load", 
this.handleFrameLoad); callbacks that are added are never removed either - 
unfortunately I do not have a way to remove them.  As far as I can tell 
ExternalInterface doesn't let me remove added callbacks.

Original issue reported on code.google.com by alan.pla...@gmail.com on 3 Nov 2008 at 11:00

GoogleCodeExporter commented 8 years ago
Hi Alan,

I had similar problem which I have addressed in a similar way. I also had the 
need to
print the IFrame contents for which I have created a patch and posted into the 
issue:
http://code.google.com/p/flex-iframe/issues/detail?id=23

Original comment by jefferyf...@gmail.com on 27 Feb 2009 at 2:15

GoogleCodeExporter commented 8 years ago
Both comments noted. I will get round to adding this in and make the 
appropriate 
attributions.

Original comment by alistair.rutherford on 6 Mar 2009 at 7:23

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago

Original comment by Julien.N...@gmail.com on 2 Oct 2009 at 7:45

GoogleCodeExporter commented 8 years ago
Integrated alan.plante's solution.

Original comment by Julien.N...@gmail.com on 3 Oct 2009 at 12:16

GoogleCodeExporter commented 8 years ago

Original comment by Julien.N...@gmail.com on 11 Oct 2009 at 12:17