Results 1 to 3 of 3

Thread: [RESOLVED] Referencing Flash Object in IE problem

  1. #1
    Join Date
    Apr 2010

    resolved [RESOLVED] Referencing Flash Object in IE problem


    I am having trouble changing the value of a flash object using JS in IE. The flash code is below

    <object id="FlashID" classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" width="721" height="423">
    <param name="movie" id="movie" value="../../flash/world.swf">
    <param name="quality" value="high">
    <param name="wmode" value="opaque">
    <param name="swfversion" value="">
    <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you donít want users to see the prompt. -->
    <param name="expressinstall" value="Scripts/expressInstall.swf">
    <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
    <!--[if !IE]>-->
    <object name="world2" id="world2" type="application/x-shockwave-flash" data="../../flash/world.swf" width="721" height="423">
    <param name="quality" value="high">
    <param name="wmode" value="opaque">
    <param name="swfversion" value="">
    <param name="expressinstall" value="Scripts/expressInstall.swf">
    <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
    <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
    <p><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" width="112" height="33" /></a></p>
    <!--[if !IE]>-->


    I know there are differences in the way browsers handle getElement functions and I assume this will be the problem here.

    Using document.getElementByID works correctly in all browsers except IE.

    I use document.getElementsByName for IE which at least locates the Flash object and doesnt throw up any errors. However ideally I want to change the "value" and "data" values using JS. As I said I can do this using ElementByID in all other browsers. I cannot get IE to change the value of the value and data fields.

    Any Ideas?

    The JS Code for IE is:

    var flash1 = document.getElementsByName('world2');
    var flash2 = document.getElementsByName('movie');

    else if (a == "open" && navigator.appName.indexOf("Microsoft Internet")!=-1){

    document.getElementById('curtain').style.display= "block";
    document.getElementById('world').style.display= "block";
    flash1.data = "../../flash/"+b+".swf";
    flash2.value = "../../flash/"+b+".swf";
    document.getElementById('myspeed').style.display= "none";



  2. #2
    Join Date
    Apr 2003
    This script swaps YouTube videos, which is essentially your goal.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script type="text/javascript">
    function changeVideo(val) {
    var parent = document.getElementById("playing"); 
    try { // for IE
        var emb = document.createElement('<embed src="http://www.youtube.com/v/'+val+'&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344">');
    catch (e) {
        var o = document.createElement('object');
        o.setAttribute('width', '425');
        o.setAttribute('height', '344');
        var p = document.createElement('param');
        p.setAttribute('name', 'movie');
        p.setAttribute('value', 'http://www.youtube.com/v/' + val + '&fs=1');
        p = document.createElement('param');
        p.setAttribute('name', 'allowFullScreen');
        p.setAttribute('value', 'true');
        p = document.createElement('param');
        p.setAttribute('name', 'allowscriptaccess');
        p.setAttribute('value', 'always');
        var e = document.createElement('embed');
        e.setAttribute('src', 'http://www.youtube.com/v/' + val + '&fs=1');
        e.setAttribute('type', 'application/x-shockwave-flash');
        e.setAttribute('allowscriptaccess', 'always');
        e.setAttribute('allowfullscreen', 'true');
        e.setAttribute('width', '425');
        e.setAttribute('height', '344');
    <style type="text/css">
    * {margin:0;padding:0;}
    <div id="playing">
    <object width="425" height="344">
    <param name="movie" value="http://www.youtube.com/v/bT_8Dvk5GIQ&fs=1">
    <param name="allowFullScreen" value="true">
    <param name="allowscriptaccess" value="always">
    <embed src="http://www.youtube.com/v/bT_8Dvk5GIQ&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed>
        <select name="videos" onchange="changeVideo(this.value)">
            <option value="bT_8Dvk5GIQ">video 1</option>
            <option value="2t3ZysHg3Cc">video 2</option>
            <option value="9-l_oeJY8mQ">video 3</option>
    At least 98% of internet users' DNA is identical to that of chimpanzees

  3. #3
    Join Date
    Apr 2010
    thanks, that worked a treat!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center