Thank you, Mike. With a few adjustments, I have this working in the 
iPhone browser. I tested also in Mac Safari and Firefox with Flash 
Player uninstalled and it works in those browsers as well.

Are you basing this off of SwfObject 2.2 or an earlier version? I had to 
alter your code a bit to get it to work.

The original SwfObject 2.2 code that is being replaced had a call to 
setVisibility(replaceElemIdStr, true); to make the content visible. Your 
customization did not and the alternate content was invisible. I added 
this back in and then it worked.

I also noticed that in 2.2, your customization would already be in an 
addDomLoadEvent function, so I removed that portion. And last, 2.2 has 
some callback code at the end of the embedSWF function that is missing 
in your customization.

Here is the original SwfObject 2.2 code:

embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, 
swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
. . .
. . .
            else { // show alternative content
                setVisibility(replaceElemIdStr, true);
            }
            if (callbackFn) { callbackFn(callbackObj); }
        });
    }
    else if (callbackFn) { callbackFn(callbackObj);    }
},


Here is the revised code:

embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, 
swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
. . .
. . .
            else { // show alternative content
                var e = getElementById ( replaceElemIdStr );
                var c = e.getElementsByTagName ( "noscript" );
                if ( c.length > 0 && c [ 0 ].textContent != null && c
    [ 0 ].textContent.length > 0 )
                {
                    e.innerHTML = c [ 0 ].textContent;
                }
                else
                {
                    var scan = e.firstChild;
                    while ( scan != null )
                    {
                        if ( scan.nodeType == 8 )
                        {
                            var value = scan.nodeValue;
                            value = value.replace ( new RegExp ( 
"__escaped_end_comment__",
    "g" ), "-->" );
                            e.innerHTML = value;
                            break;
                        }
   
                        scan = scan.nextSibling;
                    }
                }
                setVisibility(replaceElemIdStr, true);
            }
            if (callbackFn) { callbackFn(callbackObj); }
        });
    }
    else if (callbackFn) { callbackFn(callbackObj);    }
},


It should be noted for anyone else trying this that you only need to use 
__escaped_end_comment__ if you want to have actual html comments within 
your alternate content. If not, just comment out the alt content like this:

<div id="flashcontent">
        <noscript>
                <a href="http://www.adobe.com/go/getflashplayer";>
                        <img 
src="http://www.adobe.com/images/shared/download_buttons/
get_flash_player.gif" alt="Get Adobe Flash player" />
                </a>
                <img src="massive_image.jpg" />
        </noscript>

        <!--
                <a href="http://www.adobe.com/go/getflashplayer";>
                        <img 
src="http://www.adobe.com/images/shared/download_buttons/
get_flash_player.gif" alt="Get Adobe Flash player" />
                </a>
                <img src="massive_image.jpg" />
        -->
</div>


Thanks again, Mike. This is a great solution!

Alan


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to