Javascript and flash

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • th1982
    New Member
    • Feb 2008
    • 51

    #31
    Hi gits
    have you seen any problem with my code?
    Thanks gits

    Comment

    • gits
      Recognized Expert Moderator Expert
      • May 2007
      • 5388

      #32
      Originally posted by th1982
      Hi gits
      have you seen any problem with my code?
      Thanks gits
      unfortunatly not yet ... have to test it at a windows machine with an IE on it :) ...
      may be today i'll find time for it ...

      kind regards

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5388

        #33
        it seems to be a problem with retrieving the emebed-node in IE from the object so we just avoid it in that case with the following code:

        [CODE=javascript]if (typeof window.event == 'undefined') {
        var embd = video.getElemen tsByTagName('em bed')[0];
        embd.setAttribu te('src', src);
        }
        [/CODE]
        just replace the lines in the code and it should work now :)

        kind regards

        Comment

        • th1982
          New Member
          • Feb 2008
          • 51

          #34
          Thanks gits

          pls check my code :


          [HTML]<!--<SCRIPT LANGUAGE="JavaS cript" TYPE="text/javascript">

          function change(node) {
          var video = document.getEle mentById('video _container');
          var n_video = video.cloneNode (true);

          n_video.src = "flash/video" + node.value + ".swf";

          video.parentNod e.replaceChild( n_video, video);
          }



          </SCRIPT>
          <SCRIPT LANGUAGE="JavaS cript" TYPE="text/javascript">
          function change(node) {
          var video = document.getEle mentById('video _container');
          var o_param = video.getElemen tsByTagName('pa ram')[0];
          var src = 'flash/video' + node.value + '.swf';
          o_param.value = src;

          var embd = video.getElemen tsByTagName('em bed')[0];
          embd.setAttribu te('src', src);

          var n_video = video.cloneNode (true);



          video.parentNod e.replaceChild( n_video, video);
          }

          </SCRIPT>-->
          <SCRIPT LANGUAGE="JavaS cript" TYPE="text/javascript">
          function change(node) {
          var video = document.getEle mentById('video _container');
          var o_param = video.getElemen tsByTagName('pa ram')[0];
          var src = 'flash/video' + node.value + '.swf';
          o_param.value = src;


          if (typeof window.event == 'undefined') {

          var embd = video.getElemen tsByTagName('em bed')[0];

          embd.setAttribu te('src', src);

          }

          var n_video = video.cloneNode (true);



          video.parentNod e.replaceChild( n_video, video);
          }

          </SCRIPT>
          <table>
          <tr>

          <td style="padding-left:0px;"><tab le width="200" border="0" cellpadding="0" cellspacing="0" >

          <tr>
          <td><a href="index.php ?l1=163&l2=166" ><img src="img/latestnews.gif" width="204" border="0"></a></td>
          </tr>
          <tr><td colspan="0" bgcolor="#c0c8c 7" align="left" > <?php include("small. php"); ?></td></tr>

          </table></td>

          </tr>

          <tr>

          <td style="padding-left:0x;"><tabl e width="200" border="0" cellpadding="0" cellspacing="0" >

          <tr>

          <td><a href="apply_for m.php"><img src="img/career-icon.gif" width="204" border=""></a></td>

          </tr>

          </table></td>

          </tr>

          <table>
          <tr width="204px" bgcolor="#c0c8c 7">

          <td align="right">< table width="100%" border="0" cellpadding="3" >

          <tr>

          <td>Video
          <select name="select" style="width:14 0px;" onchange="chang e(this);">



          <option id="0" value="0">VFM - ad</option>

          <option id="1" value="1">VFM - Introduction</option>

          <option id="2" value="2">VFM - VietNam: The potential market</option>

          </select> </td>

          </tr>
          </table>

          <!--<OBJECT classid="clsid: D27CDB6E-AE6D-11cf-96B8-444553540000"
          codebase="http://download.macrom edia.com/pub/shockwave/cabs/flash/swflash.cab#ver sion=6,0,40,0"
          WIDTH="204" HEIGHT="200" id="video_conta iner"><param name="movie" value="flash/video0.swf" /><PARAM NAME=quality VALUE=high><PAR AM NAME=bgcolor VALUE=#FFFFFF>< EMBED src="flash/video0.swf" id="video_conta iner" quality=high bgcolor=#FFFFFF WIDTH="204" HEIGHT="183"
          NAME="myMovieNa me" ALIGN="" TYPE="applicati on/x-shockwave-flash"
          PLUGINSPAGE="ht tp://www.macromedia. com/go/getflashplayer" ></EMBED></OBJECT></tr></table>
          <OBJECT classid="clsid: D27CDB6E-AE6D-11cf-96B8-444553540000"
          codebase="http://download.macrom edia.com/pub/shockwave/cabs/flash/swflash.cab#ver sion=6,0,40,0"
          WIDTH="170" HEIGHT="210"><p aram name="quality" value="high" />
          <embed src="flash/video0.swf" width="170" height="210" loop="false" align="right" id="video_conta iner" quality="high" pluginspage="ht tp://www.adobe.com/shockwave/download/download.cgi?P1 _Prod_Version=S hockwaveFlash" type="applicati on/x-shockwave-flash" AUTOPLAY="FALSE " play="false"></embed> </object> -->

          <!--<object classid="clsid: D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macrom edia.com/pub/shockwave/cabs/flash/swflash.cab#ver sion=6,0,40,0"" width="204" height="183" id="video_conta iner"><param name="movie" value="flash/video0.swf" /> <param name="quality" value="high" /> </object> -->

          <object classid="clsid: D27CDB6E-AE6D-11cf-96B8-444553540000"
          codebase="http://download.macrom edia.com/pub/shockwave/cabs/flash/swflash.cab#ver sion=6,0,0,0"
          width="204" height="200" id="video_conta iner">
          <param name="movie" value="flash/video0.swf" />
          <embed src="flash/video0.swf" width="204" height="235"
          quality="high" name="movie"
          type="applicati on/x-shockwave-flash"
          pluginspage="ht tp://www.macromedia. com/go/getflashplayer"/>
          </object>


          </tr></table> [/HTML]




          It still does not work.and get the same problem,not change video,only play video0.swf

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5388

            #35
            i just copied your code and tested in FF and IE6 and it worked as expected ... what IE is not working? do you get any errors?

            Comment

            • th1982
              New Member
              • Feb 2008
              • 51

              #36
              Thanks gits
              But my IE is 7, maybe problem from it?
              thanks

              Comment

              • gits
                Recognized Expert Moderator Expert
                • May 2007
                • 5388

                #37
                that could be ... but if that is the case i first have to find a machine here to test the code with such a IE7 ... since i don't have one already :)

                kind regards

                Comment

                • th1982
                  New Member
                  • Feb 2008
                  • 51

                  #38
                  thanks gits
                  that is so good to me to learn.
                  thanks so much.see you soon in orher topic
                  best regards

                  Comment

                  Working...