1 2 Previous Next 40 Replies Latest reply on Jan 17, 2012 7:43 AM by kglad

    Playing video on a html with jquery

    Tony404 Level 1

      Hi

       

      I have a php/sql database that has thumb nails and videos in swf format and flv. On my html page I have an swf player. I have echoed

      the thumbnails and have the url of the videos. How can I get the video url playing on the player after a person clicks the thumbnail with

      out xml. Just by passing the url to the player. Kind of how youtube works thanks.

       

      I have hand some sucess with xml passing but this can`t  work in this aspect. So I have been investigating jquery and other alternatives.

       

      Hope you can help.

       

      Thanks.

        • 1. Re: Playing video on a html with jquery
          kglad Adobe Community Professional & MVP

          you're loading the xml with jquery but all the thumbnails are in your swf?

          • 2. Re: Playing video on a html with jquery
            Tony404 Level 1

            Hi thanks for the reply.

             

            Oh no. I have a folder Thumbnail and folder videos. I then have a phpmyadmin table called videos containing urls of the thumbnail and video.

             

            On the html I echo the thumbnail of a particular video. the html contains a videoplayer with play, pause, stop menu. So I am trying to

            use jquery to automaticly pass the url of the video into the videoplayer to play with out having to echo nessary xml maybe through

            some actionscript that reads the passed url and plays the video.

             

            I hope this makes sense thanks.

            • 3. Re: Playing video on a html with jquery
              kglad Adobe Community Professional & MVP

              what part of your project is in the swf?  the video player with the play,pause,stop controls?  so, only the video's url needs to be passed to the swf embedded in your html page?

              • 4. Re: Playing video on a html with jquery
                Tony404 Level 1

                Thanks again for the reply.

                 

                so the videos are in two formats .flv and swf. So I can play an embedded swf video from the database but the video will play

                with out controls play,pause or stop. It will just be a video embedded on the page. I created a separate player in flash cs5 that

                has controls exported it as swf and embedded it on the page and know trying to pass the different video files from the datebase to be playable

                with controls.

                 

                 

                Thanks.

                • 5. Re: Playing video on a html with jquery
                  kglad Adobe Community Professional & MVP

                  in your html, add the following to your javascript/jquery:

                   

                   

                  function thisMovie(movieName) {

                           if (navigator.appName.indexOf("Microsoft") != -1) {

                               return window[movieName];

                           } else {

                               return document[movieName];

                           }

                       }

                   

                       function sendToActionScript(flv) {

                           thisMovie("put_your_embedded_swfs_name_here_without_the_dot_swf").sendToActionScript(flv);

                       }

                   

                  // when you want to pass the url to flash use:

                   

                  sendToActionScript("yourflvname.flv");

                   

                  ////////////// and in your embedded swf with the player use:

                  import flash.External.ExternalInterface;

                   

                  ExternalInterface.addCallback("sendToActionScript", playFLV);

                   

                  function playFLV(flv):Void{

                  yourflv_pb.contentPath=flv;

                  //do whatever else

                  }

                  • 6. Re: Playing video on a html with jquery
                    Tony404 Level 1

                    Hi

                     

                    Thanks so much for the assistance I have just got started getting the proposed solution working.

                     

                    So in the swf players actionscript  I have modified the code to:

                     

                    //Action script

                    import flash.External.ExternalInterface;

                     

                    ExternalInterface.addCallback("sendToActionScript", playFLV);

                     

                    function playFLV(flv):Void{

                     

                    yourflv_pb.contentPath=flv;

                     

                    var flvSource:String = "yourflv_pb";

                     

                    myVid.source=flvSource;

                     

                    myVid.play();

                     

                     

                    }

                    myVid is the name of the player.  I modified the code so that it plays the video is the code above correct?

                    I am still working on the rendering the whole solution.

                    thanks again for the help.

                    • 7. Re: Playing video on a html with jquery
                      kglad Adobe Community Professional & MVP

                      are you using as2 or as3?

                      • 8. Re: Playing video on a html with jquery
                        Tony404 Level 1

                        Hi

                         

                        I am using as3.

                        • 9. Re: Playing video on a html with jquery
                          kglad Adobe Community Professional & MVP

                          1.  you're posting in the as1/as2 forum

                           

                          2.  you should be seeing error messages IF you're using as3.

                           

                          3.  what's the name of the flv you're trying to play?

                          • 10. Re: Playing video on a html with jquery
                            Tony404 Level 1

                            Hi Thanks again for help.

                             

                            I had just started coding the player part.

                             

                            The name of the flv I would like to play is passed to the player using jquery.

                             

                            So it would be

                             

                            sendToActionScript("yourflvname.flv");

                             

                            The variable contained in the above code.

                             

                            The actionscript is supposed to read the variable and play it on myVid which is the variable name for the videoplayer object inside the flash.

                             

                            I just turned the player to run with as1 and 2. So would:

                             

                             

                            //Action script

                            import flash.External.ExternalInterface;

                             

                            ExternalInterface.addCallback("sendToActionScript", playFLV);

                             

                            function playFLV(flv):Void{

                             

                            yourflv_pb.contentPath=flv;

                             

                            var flvSource:String = "yourflv_pb";

                             

                            myVid.source=flvSource;

                             

                            myVid.play();

                             

                             

                            }

                             

                            Get the variable in the sendToActionScript("yourflvname.flv");

                             

                            to play on myVid.play();

                             

                            I modified the original actionscript code posted to get the passed video playing on the video component with instance name myVid.

                             

                            Thanks.

                            • 11. Re: Playing video on a html with jquery
                              kglad Adobe Community Professional & MVP

                              as2:

                               

                               

                               

                               

                              //Action script

                              import flash.External.ExternalInterface;

                               

                              ExternalInterface.addCallback("sendToActionScript", playFLV);

                               

                              function playFLV(flv):Void{

                              myVid.contentPath=flv;

                              myVid.play();

                              }

                               

                               

                              p.s.  please mark/helpful/correct responses.

                              • 12. Re: Playing video on a html with jquery
                                Tony404 Level 1

                                Hi

                                 

                                Thanks again for the help. I am almost there. Just made a first try on my server but without any luck.

                                Below is the html and the actionscript is the same as you posted. When I click play button in the code

                                the Videos/teleme.flv is supposed to be then passed and played. Nothing happens. I think I messed up the jquery part any help

                                will be appreciated.

                                 

                                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

                                <html xmlns="http://www.w3.org/1999/xhtml">

                                <head>

                                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

                                <script type="text/javascript" src="jquery/jquery-1.4.2.min.js"></script>

                                <script src="Scripts/swfobject_modified.js" type="text/javascript"></script>

                                <script type="text/javascript">

                                $(document).ready(function() {

                                 

                                function thisMovie(movieName) {

                                 

                                         if (navigator.appName.indexOf("Microsoft") != -1) {

                                 

                                             return window[movieName];

                                 

                                         } else {

                                 

                                             return document[movieName];

                                 

                                         }

                                 

                                     }

                                     function sendToActionScript(flv) {

                                 

                                         thisMovie("JQplay").sendToActionScript(flv);

                                 

                                     }

                                });

                                </script>

                                 

                                 

                                 

                                <title>Untitled Document</title>

                                </head>

                                 

                                <body>
                                <object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="550" height="400">
                                  <param name="movie" value="JQUERYPLAY/JQplay.swf" />
                                  <param name="quality" value="high" />
                                  <param name="wmode" value="opaque" />
                                  <param name="swfversion" value="6.0.65.0" />
                                  <!-- 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 type="application/x-shockwave-flash" data="JQUERYPLAY/JQplay.swf" width="550" height="400">
                                    <!--<![endif]-->
                                    <param name="quality" value="high" />
                                    <param name="wmode" value="opaque" />
                                    <param name="swfversion" value="6.0.65.0" />
                                    <param name="expressinstall" value="Scripts/expressInstall.swf" />
                                    <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
                                    <div>
                                      <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>
                                    </div>
                                    <!--[if !IE]>-->
                                  </object>
                                  <!--<![endif]-->
                                </object>
                                <script type="text/javascript">
                                swfobject.registerObject("FlashID");
                                </script>

                                <br/>

                                <input type="button" value="play" onClick="sendToActionScript('Videos/teleme.flv');" />
                                </body>
                                </html>

                                 

                                Videos.teleme.flv is inside the JQUERYPLAY Folder when the swf is also contained. JQplay.php is in the main folder of the site.

                                 

                                thanks.

                                • 13. Re: Playing video on a html with jquery
                                  kglad Adobe Community Professional & MVP

                                  try

                                   

                                   

                                  <input type="button" value="play" onClick="sendToActionScript('../Videos/teleme.flv');" />

                                  • 14. Re: Playing video on a html with jquery
                                    Tony404 Level 1

                                    Hi

                                     

                                    Just tried it no luck. Could they be an issue with the folder arragement? JQplay.php is in the main folder of server.

                                     

                                    JQplay.swf is in JQUERYPLAY/

                                     

                                    Videos/teleme.flv is inside JQUERYPLAY.

                                     

                                     

                                    Hope you can assist.

                                     

                                    Thanks again.

                                    • 15. Re: Playing video on a html with jquery
                                      kglad Adobe Community Professional & MVP

                                      put all your files in the same directory and test so you don't have any path issues.  once you get that working you can work on setting up your files more conveniently.

                                      • 16. Re: Playing video on a html with jquery
                                        Tony404 Level 1

                                        Hi

                                         

                                        I recent but all the file in the same folder but with out any luck. I have gone over an over again on the code but can`t find any thing wrong.

                                        I think part of the problem mite be the jquery. Could browser type affect the functionality.

                                         

                                        If possible is they a way to try the same code on your machine and see how it goes it would be really helpful.

                                         

                                        Thanks.

                                         

                                        All the code is the same as we discussed on earlier posts.

                                         

                                        Appreciate the help.

                                        • 17. Re: Playing video on a html with jquery
                                          kglad Adobe Community Professional & MVP

                                          it's very unlikely there's a problem with jquery.  i have almost as much experience coding with jquery as i do with actionscript and i've found it to be very robust.

                                           

                                          p.s.  i only offer free help via the adobe forums.  if you want me to test/correct your files, you'd need to hire me.

                                          • 18. Re: Playing video on a html with jquery
                                            Tony404 Level 1

                                            Hi

                                             

                                            Thanks so much again for the help. Really appreciate.  Maybe I can upload the html page as it looks for a quick look. Maybe you mite notice

                                            something.

                                             

                                            So here goes as said earlier all file are in same folder including video:

                                             

                                            video name: teleme.flv

                                            player name: JQplay.swf with actionscript from earlier post.

                                             

                                             

                                            // JQplay.htm

                                             

                                             

                                            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

                                            <html xmlns="http://www.w3.org/1999/xhtml">

                                            <head>

                                            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

                                            <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>

                                            <script src="swfobject_modified.js" type="text/javascript"></script>

                                            <script type="text/javascript">

                                             

                                            $(document).ready(function() {

                                             

                                            function thisMovie(movieName) {

                                             

                                                     if (navigator.appName.indexOf("Microsoft") != -1) {

                                             

                                                         return window[movieName];

                                             

                                                     } else {

                                             

                                                         return document[movieName];

                                             

                                                     }

                                             

                                                 }

                                                 function sendToActionScript(flv) {

                                             

                                                     thisMovie("JQplay").sendToActionScript(flv);

                                             

                                                 }

                                            });

                                            </script>

                                             

                                             

                                            <title>Qplayer</title>

                                            </head>

                                             

                                            <body>

                                            <object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="550" height="400">

                                              <param name="movie" value="JQplay.swf" />

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

                                              <param name="wmode" value="opaque" />

                                              <param name="swfversion" value="6.0.65.0" />

                                              <!-- 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="expressInstall.swf" />

                                              <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->

                                              <!--[if !IE]>-->

                                              <object type="application/x-shockwave-flash" data="JQplay.swf" width="550" height="400">

                                                <!--<![endif]-->

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

                                                <param name="wmode" value="opaque" />

                                                <param name="swfversion" value="6.0.65.0" />

                                                <param name="expressinstall" value="expressInstall.swf" />

                                                <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->

                                                <div>

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

                                                </div>

                                                <!--[if !IE]>-->

                                              </object>

                                              <!--<![endif]-->

                                            </object>

                                            <script type="text/javascript">

                                            swfobject.registerObject("FlashID");

                                            </script>

                                             

                                            <br/>

                                            <input type="button" value="play" onClick="sendToActionScript('teleme.flv');" />

                                             

                                            </body>

                                            </html>

                                             

                                            The actionscript loading flv into swf player:

                                             

                                            //Action script MyVid is the player component instance

                                             

                                            import flash.External.ExternalInterface;

                                             

                                            ExternalInterface.addCallback("sendToActionScript", playFLV);

                                             

                                             

                                            function playFLV(flv):Void{

                                             

                                            myVid.contentPath=flv;

                                             

                                            myVid.play();

                                             

                                            }

                                             

                                             

                                            Please reply if you find any thing out of place.

                                            • 19. Re: Playing video on a html with jquery
                                              kglad Adobe Community Professional & MVP

                                              i don't see where you're using jquery and there's faulty swfobject code.  try:

                                               

                                               

                                               

                                              <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

                                              <html xmlns="http://www.w3.org/1999/xhtml">

                                              <head>

                                              <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

                                              <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>

                                               

                                              <script type="text/javascript">

                                               

                                               

                                               

                                              function thisMovie(movieName) {

                                               

                                                       if (navigator.appName.indexOf("Microsoft") != -1) {

                                               

                                                           return window[movieName];

                                               

                                                       } else {

                                               

                                                           return document[movieName];

                                               

                                                       }

                                               

                                                   }

                                                   function sendToActionScript(flv) {

                                               

                                                       thisMovie("JQplay").sendToActionScript(flv);

                                               

                                                   }

                                               

                                              </script>

                                               

                                               

                                              <title>Qplayer</title>

                                              </head>

                                               

                                              <body>

                                              <object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="550" height="400">

                                                <param name="movie" value="JQplay.swf" />

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

                                                <param name="wmode" value="opaque" />

                                                <param name="swfversion" value="6.0.65.0" />

                                                <!-- 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="expressInstall.swf" />

                                                <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->

                                                <!--[if !IE]>-->

                                                <object type="application/x-shockwave-flash" data="JQplay.swf" width="550" height="400">

                                                  <!--<![endif]-->

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

                                                  <param name="wmode" value="opaque" />

                                                  <param name="swfversion" value="6.0.65.0" />

                                                  <param name="expressinstall" value="expressInstall.swf" />

                                                  <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->

                                                  <div>

                                                    <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.g if" alt="Get Adobe Flash player" width="112" height="33" /></a></p>

                                                  </div>

                                                  <!--[if !IE]>-->

                                                </object>

                                                <!--<![endif]-->

                                              </object>

                                               

                                              <br/>

                                              <input type="button" value="play" onClick="sendToActionScript('teleme.flv');" />

                                               

                                              </body>

                                              </html>

                                              • 20. Re: Playing video on a html with jquery
                                                Tony404 Level 1

                                                Hi

                                                 

                                                Thanks so much for the help. I am not sure what faulty swfobject code is but I just tried the code without no luck.

                                                 

                                                http://www.expishare.com/interactive/JQplay.html

                                                 

                                                or

                                                 

                                                http://www.expishare.com/interactive/JQplay.php

                                                 

                                                to check out. you can use view source to see code the teleme.flv is in same folder.

                                                 

                                                I am constantly trying out many things and hope to get lucky. Fingers crossed.

                                                 

                                                What debug method could I try like in actionscript to check if the variable arrived. Maybe a if statement or error check to verify that flash is recieving

                                                the video?

                                                • 21. Re: Playing video on a html with jquery
                                                  kglad Adobe Community Professional & MVP

                                                  you must publish for fp 8 or better.

                                                  • 22. Re: Playing video on a html with jquery
                                                    Tony404 Level 1

                                                    Hi

                                                     

                                                    fp 8 ? Is that frame rate?

                                                    • 23. Re: Playing video on a html with jquery
                                                      kglad Adobe Community Professional & MVP

                                                      that's the flash player version.  you're publishing for flash player 6 which does not support the externalinterface class.

                                                      • 24. Re: Playing video on a html with jquery
                                                        Tony404 Level 1

                                                        Hi

                                                         

                                                        That really mite be the problem because the externalinterface class is in the actionscript. I tried modifying the publish settings which

                                                        say its flash player 12. I even tried  to modify to flash player 8.

                                                         

                                                        Is they a way I can modify the actionscript to work with current version or manual modify the version in the code>

                                                         

                                                        Thanks.

                                                        • 25. Re: Playing video on a html with jquery
                                                          kglad Adobe Community Professional & MVP

                                                          if you publish for flash player 8 or better you can use the externalinterface class.  otherwise, you have to use getURL().

                                                          • 26. Re: Playing video on a html with jquery
                                                            Tony404 Level 1

                                                            Hi

                                                             

                                                            Thanks so much. Since you made the post I have been looking at some getURL() examples of doing the same as externalinterface but there is no

                                                            exact one that is suitable for working it in this circumstance.

                                                             

                                                            So how can:

                                                             

                                                            import flash.External.ExternalInterface;

                                                             

                                                            ExternalInterface.addCallback("sendToActionScript", playFLV);

                                                            function playFLV(flv):Void{

                                                            myVid.contentPath=flv;

                                                            myVid.play();

                                                            }

                                                             

                                                            using getUrl() playing video instantly.

                                                             

                                                            Thanks so much.

                                                            • 27. Re: Playing video on a html with jquery
                                                              kglad Adobe Community Professional & MVP

                                                              you're correct.  you can use getURL to communicate from actionscript to javascript but not vice-versa.

                                                              • 28. Re: Playing video on a html with jquery
                                                                Tony404 Level 1

                                                                Oh Okay.

                                                                 

                                                                So what option do I have? How can I manually publish high than flashplayer version 6 . Is there a way to manually change the version

                                                                after flash is published? Its weird I used the publish settings to publish flashplayer 12 but in the html it show some thing like

                                                                version 6. I am using dreamweaver after publishing.

                                                                 

                                                                 

                                                                Thanks.

                                                                • 29. Re: Playing video on a html with jquery
                                                                  kglad Adobe Community Professional & MVP

                                                                  what version of the flash program are you using?

                                                                  • 30. Re: Playing video on a html with jquery
                                                                    Tony404 Level 1

                                                                    Hi

                                                                     

                                                                    Flash CS5 with actionscript 2. On old laptop.

                                                                    • 31. Re: Playing video on a html with jquery
                                                                      kglad Adobe Community Professional & MVP

                                                                      if you have cs5 why don't you publish for fp 8 or better??

                                                                      • 32. Re: Playing video on a html with jquery
                                                                        Tony404 Level 1

                                                                        Hi

                                                                         

                                                                        Finally got it to fp8.

                                                                         

                                                                        Check: http://www.expishare.com/interactive/JQplay.htm

                                                                         

                                                                        if you click play below the player the vid should play. But no luck.

                                                                         

                                                                        teleme.flv is in the same folder and actionscript same. Constantly trying  other things.

                                                                         

                                                                        Any idea will be appreciated.

                                                                         

                                                                        Thanks.

                                                                        • 33. Re: Playing video on a html with jquery
                                                                          Tony404 Level 1

                                                                          Hi again

                                                                           

                                                                          I just needed your assistance on a solution that works for text but needs modifiication to enable video.The solution uses Flashvars:

                                                                           

                                                                          2 php variables are passed to swf and displayed on textfield.

                                                                           

                                                                          <?php

                                                                          $id = "monito";

                                                                          $code = "teleme.flv";

                                                                          ?>

                                                                          <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

                                                                          <head>

                                                                          <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

                                                                          <title>AS3</title>

                                                                          <script language="javascript">AC_FL_RunContent = 0;</script>

                                                                          <script src="AC_RunActiveContent.js" language="javascript"></script>

                                                                          </head>

                                                                          <body bgcolor="#333333">

                                                                          <!--url's used in the movie-->

                                                                          <!--text used in the movie-->

                                                                          <!-- saved from url=(0013)about:internet -->

                                                                          <script language="javascript">

                                                                              if (AC_FL_RunContent == 0) {

                                                                                  alert("This page requires AC_RunActiveContent.js.");

                                                                              } else {

                                                                                  AC_FL_RunContent(

                                                                                      'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',

                                                                                      'width', '500',

                                                                                      'height', '500',

                                                                                      'src', 'AS3_php_Var_into_flash',

                                                                                      'FlashVars', 'itemID=<?php print "$id"; ?>&itemCode=<?php print "$code"; ?>',           

                                                                                      'quality', 'high',

                                                                                      'pluginspage', 'http://www.macromedia.com/go/getflashplayer',

                                                                                      'align', 'middle',

                                                                                      'play', 'true',

                                                                                      'loop', 'true',

                                                                                      'scale', 'showall',

                                                                                      'wmode', 'window',

                                                                                      'devicefont', 'false',

                                                                                      'id', 'AS3_php_Var_into_flash',

                                                                                      'bgcolor', '#ffffff',

                                                                                      'name', 'AS3_php_2_Var_into_flash',

                                                                                      'menu', 'true',

                                                                                      'allowFullScreen', 'false',

                                                                                      'allowScriptAccess','sameDomain',

                                                                                      'movie', 'AS3_php_2_Var_into_flash',

                                                                                      'salign', ''

                                                                                      ); //end AC code

                                                                              }

                                                                          </script>

                                                                          <noscript>

                                                                              <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="500" height="500" id="AS3_php_Var_into_flash" align="middle">

                                                                              <param name="allowScriptAccess" value="sameDomain" />

                                                                              <param name="allowFullScreen" value="false" />

                                                                              <param name="movie" value="AS3_php_2_Var_into_flash.swf" />

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

                                                                              <param name="bgcolor" value="#ffffff" />   

                                                                              <param name="FlashVars" value="itemID=<?php print "$id"; ?>&itemCode=<?php print "$code"; ?>">

                                                                              <embed src="AS3_php_2_Var_into_flash.swf" FlashVars="itemID=<?php print "$id"; ?>&itemCode=<?php print "$code"; ?>" quality="high" bgcolor="#ffffff" width="400" height="150" name="AS3_php_2_Var_into_flash" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

                                                                              </object>

                                                                          </noscript>

                                                                          </body>

                                                                          </html>

                                                                           

                                                                           

                                                                          Can you help me with actionscript 3 or 2 to grab the 2 variables and play them in a video playback component instance name Myvid

                                                                           

                                                                          The current actionscript reads the variables and displays them on textfield: this code:

                                                                           

                                                                          // Claim the offset Number that spaces the text

                                                                          // fields so they are not right on top of each other

                                                                          var offSet:Number = 32;

                                                                          // Claim keyStr variable as a string

                                                                          var keyStr:String;

                                                                          // Claim valueStr variable as a string

                                                                          var valueStr:String;

                                                                          // Create the paramObj Object and set it to load parameters

                                                                          // from the root level being sent in by FlashVars externally

                                                                          var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;

                                                                           

                                                                          // Set Text Format Object, its attributes and values

                                                                          var format:TextFormat = new TextFormat();

                                                                                format.font = "Verdana";

                                                                                format.size = 24;

                                                                          // Create the loop that iterates over all of the variables you send in using FlashVars    

                                                                          for (keyStr in paramObj) {  

                                                                                

                                                                                 valueStr = String(paramObj[keyStr]);      // This line gets the values of each variable sent in

                                                                                 var myText:TextField = new TextField(); // Create a text field to read and access each var

                                                                                 myText.defaultTextFormat = format; // Set the formatting into the text field properties

                                                                                 myText.text = keyStr + " value is: " + valueStr; // Use the vars here, I place into text field waiting

                                                                                 myText.y = offSet; // Before we place each text field on stage we offSet it

                                                                                 myText.width = 450; // Set the width of the text field

                                                                                

                                                                                 this.addChild(myText); // Now this line actually places the text field on stage

                                                                                 offSet += offSet; // Offset offSet(lol) so the next text field is 32 pixels lower

                                                                                   

                                                                          }

                                                                           

                                                                          I am trying to change that so the variable is used to play the pass video url into the videoplay name Myvid.

                                                                           

                                                                          Thanks.

                                                                           

                                                                          I am still working and modifying past code mite have a break through soon.

                                                                          • 34. Re: Playing video on a html with jquery
                                                                            kglad Adobe Community Professional & MVP

                                                                            use:

                                                                             

                                                                            myVid.content=paramObj.itemCode;

                                                                            1 person found this helpful
                                                                            • 35. Re: Playing video on a html with jquery
                                                                              Tony404 Level 1

                                                                              Hi kglad

                                                                               

                                                                              Thanks so much again. You a champ.

                                                                               

                                                                              Just tried: myVid.content=paramObj.itemCode;

                                                                               

                                                                              This is the error.

                                                                               

                                                                               

                                                                              Scene 1, Layer 'code AS3', Frame 1, Line 311119: Access of possibly undefined property content through a reference with static type fl.video:FLVPlayback.
                                                                              • 36. Re: Playing video on a html with jquery
                                                                                kglad Adobe Community Professional & MVP

                                                                                my errror.  that should be:

                                                                                 

                                                                                myVid.source=paramObj.itemCode;

                                                                                • 37. Re: Playing video on a html with jquery
                                                                                  Tony404 Level 1

                                                                                  WOW

                                                                                   

                                                                                  Finally working. you the best.

                                                                                   

                                                                                  Thanks.

                                                                                  • 38. Re: Playing video on a html with jquery
                                                                                    kglad Adobe Community Professional & MVP

                                                                                    you're welcome.

                                                                                    • 39. Re: Playing video on a html with jquery
                                                                                      Tony404 Level 1

                                                                                      Hi Kglad

                                                                                       

                                                                                      Sorry to bother you but I was wondering if you could assist in a post on the application forum related to this post.

                                                                                       

                                                                                      http://forums.adobe.com/message/4142934#4142934

                                                                                      1 2 Previous Next