Javascript and flash

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

    Javascript and flash

    Now I have 3 flash movies.I want to create a dropdown menu to select what movie i want to play.And the movie will be played below of menu.any solution for it
    thanks
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5388

    #2
    hi ...

    please show the code you already have ...

    kind regards

    Comment

    • th1982
      New Member
      • Feb 2008
      • 51

      #3
      Here is the Code:

      [HTML]<style type="text/css">
      <!--
      .style20 {font-size: 9px}
      -->
      </style>
      <!--
      <SCRIPT LANGUAGE="JavaS cript"
      TYPE="text/javascript">
      funtion change(){
      video = new Array()
      for(i=0;i<3;i++ )
      {
      video[i] = new Video()
      video[i].src = "flash/video" + i + ".swf"
      }

      window.onerror = null;}
      //-->
      </SCRIPT>
      <table border="0" cellspacing="2" >
      <tr><br /><br /><br /><br /><br /><br /></tr> <tr>
      <td style="padding-left:2px;"><tab le width="239" border="0" cellpadding="0" cellspacing="0" bgcolor="#d4d8d 9">
      <tr>
      <td><img src="img/latest news.jpg" alt="ee" width="41" height="34" /></td>
      <td style="padding-left:15px;"><p align="left"><s pan class="style20" ><strong>Lastes t News</strong> |
      Download here</span> </p></td>
      </tr>
      </table></td>
      </tr>
      <tr>
      <td style="padding-left:2px;"><tab le width="239" border="0" cellpadding="0" cellspacing="0" bgcolor="#d4d8d 9">
      <tr>
      <td width="41"><a href="index.php ?l1=161&amp;l2= 171"><img src="img/careers.jpg" alt="ee" width="41" height="34" border="0" /></a></td>
      <td style="padding-left:15px;"><a href="index.php ?l1=161&amp;l2= 171" class="tablink" ><b>Career</b> | Apply now!</a></td>
      </tr>
      </table></td>
      </tr>
      <tr>
      <td ><table width="100%" border="0" cellpadding="3" >
      <tr>
      <td>Video</td>
      <td><select name="select" id=numpage onChange="chang e()">

      <option value="0">VFM - ad</option>
      <option value="1">VFM - Introduction</option>
      <option value="2">VFM - VietNam: The potential market</option>
      </select>
      </td>
      </tr>
      </table>
      <param name="quality" value="high" />
      <embed src="flash/video0.swf" quality="high" pluginspage="ht tp://www.adobe.com/shockwave/download/download.cgi?P1 _Prod_Version=S hockwaveFlash" type="applicati on/x-shockwave-flash" width="270" height="250"></embed>
      </tr>
      </table>[/HTML]

      Thanks
      Last edited by gits; Feb 29 '08, 07:45 AM. Reason: added code tags

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5388

        #4
        hi ...

        first give your embed-node an id:

        Code:
        id="video_container"
        second chnage the change-function to this:

        [CODE=javascript]funtion change(node) {
        var video = document.getEle mentById('video _container');
        video[i].src = "flash/video" + node.value + ".swf";
        }
        [/CODE]
        last - call the function like this:

        [HTML]<select name="select" id="numpage" onchange="chang e(this);">[/HTML]
        kind regards

        Comment

        • th1982
          New Member
          • Feb 2008
          • 51

          #5
          am i correct with this?Thanks yo yr help
          Code:
          <style type="text/css">
          <!--
          .style20 {font-size: 9px}
          -->
          </style>
          <!--
          <SCRIPT LANGUAGE="JavaScript"
          TYPE="text/javascript">
          funtion change(node) {
              var video = document.getElementById('video_container');
              video[i].src = "flash/video" + node.value + ".swf";
          }
          
          //-->
          </SCRIPT> 
          <table border="0" cellspacing="2">
             <tr><br /><br /><br /><br /><br /><br /></tr> <tr>
              <td style="padding-left:2px;"><table width="239" border="0" cellpadding="0" cellspacing="0" bgcolor="#d4d8d9">
                  <tr>
                    <td><img src="img/latest news.jpg" alt="ee" width="41" height="34" /></td>
                    <td style="padding-left:15px;"><p align="left"><span class="style20"><strong>Lastest News</strong> |
                      Download here</span> </p></td>
                  </tr>
              </table></td>
            </tr>
            <tr>
              <td style="padding-left:2px;"><table width="239" border="0" cellpadding="0" cellspacing="0" bgcolor="#d4d8d9">
                  <tr>
                    <td width="41"><a href="index.php?l1=161&l2=171"><img src="img/careers.jpg" alt="ee" width="41" height="34" border="0" /></a></td>
                    <td style="padding-left:15px;"><a href="index.php?l1=161&l2=171" class="tablink"><b>Career</b> |  Apply now!</a></td>
                  </tr>
              </table></td>
            </tr>
            <tr>
              <td ><table width="100%" border="0" cellpadding="3">
                <tr>
                    <td>Video</td>
                    <td><select name="select" id=numpage onChange="change(this)">
                      
                        <option value="0">VFM - ad</option>
                          <option value="1">VFM - Introduction</option>
                          <option value="2">VFM - VietNam: The potential market</option>
                    </select>
                      </td>
                </tr>
                </table>
              <param name="quality" value="high" />
              <embed id="video_container"
           src="flash/video0.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="270" height="250"></embed>
              </tr>
          </table>

          Comment

          • th1982
            New Member
            • Feb 2008
            • 51

            #6
            Like the code above ,it dosen't work
            another way to do it.thanks for supporting.

            Comment

            • gits
              Recognized Expert Moderator Expert
              • May 2007
              • 5388

              #7
              do you get any errors? btw. please set the id-name of your select-node in quotes like all attributes of a node has to be in quotes ... (onclick, id, readonly etc.)

              kind regards

              Comment

              • th1982
                New Member
                • Feb 2008
                • 51

                #8
                You can take a look to this link :

                it's not effected.
                thanks

                Comment

                • gits
                  Recognized Expert Moderator Expert
                  • May 2007
                  • 5388

                  #9
                  ahhhrg :) ... sorry ... my bad i gave you the following line:

                  [CODE=javascript]video[i].src = "flash/video" + node.value + ".swf";
                  [/CODE]
                  just use:

                  [CODE=javascript]video.src = "flash/video" + node.value + ".swf";[/CODE]
                  kind regards

                  Comment

                  • th1982
                    New Member
                    • Feb 2008
                    • 51

                    #10
                    Still not working.Even I changed to this :
                    [html]

                    <style type="text/css">



                    .style20 {font-size: 9px}



                    </style>



                    <SCRIPT LANGUAGE="JavaS cript" TYPE="text/javascript">
                    function change(node) {

                    var video = document.getEle mentById('video _container');

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

                    }


                    </SCRIPT>

                    <table border="0" cellspacing="2" >

                    <tr><br /><br /><br /><br /><br /><br /></tr> <tr>

                    <td style="padding-left:2px;"><tab le width="239" border="0" cellpadding="0" cellspacing="0" bgcolor="#d4d8d 9">

                    <tr>

                    <td><img src="img/latest news.jpg" alt="ee" width="41" height="34" /></td>

                    <td style="padding-left:15px;"><p align="left"><s pan class="style20" ><strong>Lastes t News</strong> |

                    Download here</span> </p></td>

                    </tr>

                    </table></td>

                    </tr>

                    <tr>

                    <td style="padding-left:2px;"><tab le width="239" border="0" cellpadding="0" cellspacing="0" bgcolor="#d4d8d 9">

                    <tr>

                    <td width="41"><a href="index.php ?l1=161&l2=171" ><img src="img/careers.jpg" alt="ee" width="41" height="34" border="0" /></a></td>

                    <td style="padding-left:15px;"><a href="index.php ?l1=161&l2=171" class="tablink" ><b>Career</b> | Apply now!</a></td>

                    </tr>

                    </table></td>

                    </tr>

                    <tr>

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

                    <tr>

                    <td>Video</td>

                    <td><select name="select" id="numpage" 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>

                    <param name="quality" value="high" />

                    <embed id="video_conta iner" src="flash/video0.swf" quality="high" pluginspage="ht tp://www.adobe.com/shockwave/download/download.cgi?P1 _Prod_Version=S hockwaveFlash" type="applicati on/x-shockwave-flash" width="270" height="250"></embed>

                    </tr>

                    </table>
                    [/html]

                    Comment

                    • th1982
                      New Member
                      • Feb 2008
                      • 51

                      #11
                      pls help!!!
                      have any solutions for this?
                      thanks alot

                      Comment

                      • gits
                        Recognized Expert Moderator Expert
                        • May 2007
                        • 5388

                        #12
                        hi ...

                        may be we have to rewrite the entire embed-node ... so try this:

                        [CODE=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);
                        }
                        [/CODE]
                        kind regards

                        Comment

                        • th1982
                          New Member
                          • Feb 2008
                          • 51

                          #13
                          Finnaly , it's worked.Thanks alot gits.Pls help me next time
                          best regards.

                          Comment

                          • gits
                            Recognized Expert Moderator Expert
                            • May 2007
                            • 5388

                            #14
                            no problem :) ... thats the purpose of this forum :D ... so post back to the forum anytime you have more questions ...

                            kind regards

                            Comment

                            • th1982
                              New Member
                              • Feb 2008
                              • 51

                              #15
                              Hi gits
                              i have problem when i run this script in IE:http://www.purpleasia.com/clients/VF...dex.php?l1=161
                              FF is no problem
                              why is it?thanks so much

                              Comment

                              Working...