Javascript and flash

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5388

    #16
    i don't have an IE (mac-user ;) ) ... so what is not working ... do you get an error?

    kind regards

    Comment

    • th1982
      New Member
      • Feb 2008
      • 51

      #17
      oh sorry!
      only first clip can run,second and third clips are not disappeared
      and select box very small , i can only see "V"characte r(in FF i can see the full text inside the select box).
      thanks to yr answer.

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5388

        #18
        hmmm ... the selectbox issue comes from you selects css style - just remove it to see the effect ...

        the other issue with the replacing of the nodes ... seems to be an IE bug (look here ) and may be you should replace the embed with the object tag - which is the w3c standards-compliant way to embed flash ... have a look at the link in the answers at quirksmode.org (i mean this one) ...

        kind regards

        Comment

        • th1982
          New Member
          • Feb 2008
          • 51

          #19
          Thanks very much!!!
          I've tried to put it in 2 ways like this :
          First :
          [html]<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"><PA RAM NAME=quality VALUE=high><PAR AM NAME=bgcolor VALUE=#FFFFFF>< EMBED src="flash/video0.swf" 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> [/html]

          Second :

          [html]
          <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>
          [/html]

          Results : FF and IE : only play video0.swf which we put in the code.
          are anything wrong from these code?

          Thanks
          best regards

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5388

            #20
            ... and you have to change the javascript function too ... since the movie-src is now defined in the param-node ...

            kind regards

            Comment

            • th1982
              New Member
              • Feb 2008
              • 51

              #21
              the function will be like this ,am i right?

              [html]
              <SCRIPT LANGUAGE="JavaS cript" TYPE="text/javascript">

              function change(node) {

              var movie = document.getEle mentById('video _container');
              var n_movie = movie.cloneNode (true);



              n_movie.value= "flash/video" + node.value + ".swf";



              movie.parentNod e.replaceChild( n_movie, movie);

              }


              </SCRIPT>
              [/html]

              Comment

              • gits
                Recognized Expert Moderator Expert
                • May 2007
                • 5388

                #22
                nope ... that should have worked with the 'embed-version' ... :)

                try this:

                [CODE=javascript]
                function change(node) {
                var video = document.getEle mentById('video _container');
                var o_param = video.getElemen tsByTagName('pa ram')[0];
                var n_param = o_param.cloneNo de(true);

                n_param.setAttr ibute('value', 'flash/video' + node.value + '.swf');

                n_param.parentN ode.replaceChil d(n_param, o_param);
                }
                [/CODE]
                kind regards

                Comment

                • th1982
                  New Member
                  • Feb 2008
                  • 51

                  #23
                  i changed the code like this :

                  [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 n_param = o_param.cloneNo de(true);

                  n_param.setAttr ibute('value', 'flash/video' + node.value + '.swf');

                  o_param.parentN ode.replaceChil d(n_param, o_param);
                  }

                  </SCRIPT>
                  <table>
                  <tr>

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

                  <tr>
                  <td><img src="img/latestnews.gif" width="204"></td>
                  </tr>

                  </table></td>

                  </tr>

                  <tr>

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

                  <tr>

                  <td><img src="img/career-icon.gif" width="204" border="0"></td>

                  </tr>

                  </table></td>

                  </tr>

                  <table>
                  <tr>

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

                  <tr>

                  <td>Video</td>

                  <td><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="183" 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="204" HEIGHT="183"><p aram name="quality" value="high" />
                  <embed src="flash/video0.swf" width="204" height="183" 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>
                  </tr></table>
                  [/html]

                  but the video's disappeared in FF , and in IE ,video0 appear but can not change to the others

                  Comment

                  • th1982
                    New Member
                    • Feb 2008
                    • 51

                    #24
                    sorry gits!
                    pls try to help me to solve this problem.
                    thanks
                    best regards

                    Comment

                    • gits
                      Recognized Expert Moderator Expert
                      • May 2007
                      • 5388

                      #25
                      ok ... the following solution seems to work ... but i don't like it very much ... due to some browser-specs that have to be used here:

                      the js-function should be:

                      [CODE=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);
                      }
                      [/CODE]
                      and the flash should be embeded the following way:

                      [HTML]<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="270" height="183" id="video_conta iner">
                      <param name="movie" value="flash/video0.swf" />
                      <embed src="flash/video0.swf" width="270" height="183"
                      quality="high" name="movie"
                      type="applicati on/x-shockwave-flash"
                      pluginspage="ht tp://www.macromedia. com/go/getflashplayer"/>
                      </object>[/HTML]

                      Comment

                      • th1982
                        New Member
                        • Feb 2008
                        • 51

                        #26
                        thanks gits!!
                        but still did not work in IE...hixhix....

                        Comment

                        • gits
                          Recognized Expert Moderator Expert
                          • May 2007
                          • 5388

                          #27
                          it has to ... i just tested in IE6 and firefox 2.0.0.13 ... what IE makes the problem?

                          kind regards

                          Comment

                          • th1982
                            New Member
                            • Feb 2008
                            • 51

                            #28
                            thanks gits!
                            the problem is can not change video in IE, i only can play video0.swf when i click another one , its still video0.swf. firefox is ok .i m using IE 7
                            what is the problem ?
                            best regards

                            Comment

                            • gits
                              Recognized Expert Moderator Expert
                              • May 2007
                              • 5388

                              #29
                              please post the code you currently use ...

                              kind regards

                              Comment

                              • th1982
                                New Member
                                • Feb 2008
                                • 51

                                #30
                                [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>
                                <table>
                                <tr>

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

                                <tr>
                                <td><img src="img/latestnews.gif" width="204"></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]

                                Comment

                                Working...