Here's a possible fix to the previous code:
First of all, it works only on IE - because IE is the only one who needs
this script...
Second, it removes the jump problem mentioned in the previous code by adding
two new style declarations to the page, and then switching between
visibilities.

Looking forward to your comments!
(PS - the replaceFlash() function needs to be initiated on a window.onLoad()
event or equivalent.)

Karina


New code:
---------



//Replace all flash objects on the page with the same flash object, 
        //by rewriting the outerHTML values
        //This bypasses the new IE ActiveX object activation issue
        replaceFlash = function(){
                //Get a list of all ActiveX objects
                if (navigator.appName.indexOf("Microsoft") != -1){
                        var objects =
document.getElementsByTagName('object');        
                        for (var i=0; i<objects.length; i++){
                                var d = objects[i]
                                //This is only tested with flash, so ignore
all other types
                                //The object must therefore have the
attribute type="application/x-shockwave-flash"
                                if (d.type !=
"application/x-shockwave-flash"){
                                        continue;
                                }
        
//d.className=d.className.replace("flashInactive", "flashActive");
                                //Get the tag and attributes part of the
outer html of the object
                                var tag = d.outerHTML.split(">")[0] + ">"
                                tag = tag.replace ("flashInactive",
"flashActive")
                                
                                //The outer html omits the param tags, so we
must retrieve and insert these seperately
                                var lst = d.getElementsByTagName('param')
                                var params = ""
                                for (var j = 0; j<=lst.length; j++) {
                                        if (lst[j] != null){
                                                params += lst[j].outerHTML
                                        }
                                }
                                //Add up the various bits that comprise the
object:
                                //The tag with the attributes, the params
and it's inner html
                                var newObject = tag + params + d.innerHTML +
" </OBJECT>"
                                //And rewrite the outer html of the tag 
                                d.outerHTML = newObject
                                d.className =
d.className.replace("flashInactive", "flashActive")
                        }
                }
        }
        if (navigator.appName.indexOf("Microsoft") != -1){
                document.write ("<style>.flashInactive{visibility:hidden;}
.flashActive{visibility:visible;}</style>")     
        }

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to