3 Replies Latest reply on Jun 2, 2009 6:59 AM by kglad

    passing value from js to as in a flvplayback component not working

    PurpleArts Level 1

      hi,

       

      my flvplayback component is not working when i tried to pass the url of the video to be played from js to the actionscript.(using actionscript 2)

       

      I properly embedded the swf and added the object ids as well.

      i just assigned the url to a string and then passed it to the function in the as but it's not working...

       

      thanks in advance.

       

      you can see the attached file for reference.. thanks again..

        • 1. Re: passing value from js to as in a flvplayback component not working
          kglad Adobe Community Professional & MVP

          1.  if you're already using flashvars to pass xmlFile, why don't you also use flashvars to pass url?

           

          2.  your getFlashMovie() parameter should be SkinTest1

          • 2. Re: passing value from js to as in a flvplayback component not working
            PurpleArts Level 1

            i don't know if that is possible in flashvars but i need the javascript to pass values on me since js will do some validation. the as will be the medium to load the movie in the skin.swf

             

            the value that the javascript is passing to me is always undefined. I know that i declared the vars properly.

            since i succeeded in using this(the passing from textbox(as) to textbox(js)) in as 3 and

            i'm going crazy why the same concept is not working in as2.or something's wrong with my syntax

             

            my as:

             

            import mx.controls.SimpleButton;
            import mx.utils.Delegate;
            import com.greensock.TweenLite;
            import com.robertpenner.easing.Quad;
            import mx.video.FLVPlayback;

             

            var _flvPlayBack:FLVPlayback;
            //_flvPlayBack.contentPath = "Call_to_action.flv"

             

             

            dlpArticle_Asset_MediaDisplay_view_mc.onLoad()
            {
              trace("Alert0!");
              getVidURLFromJS();

             

            }

             

            ExternalInterface.addCallback("sendURLToFlash",null,getVidURLFromJS);

            function getVidURLFromJS(str:String):Void
            {
                trace(str);
                label_received.text = str;   //This item is undefined
               _flvPlayBack.contentPath = str; //this is also undefined.
                trace("Alert1!");

             

            }//End of Get Video  URL from JS Function

             

            here is my html:

             

            <script language="javascript" type="text/javascript" >

             

            function getFlashMovie(FlashMovie) {  
            var isIE = navigator.appName.indexOf("Microsoft") != -1;  
            return (isIE) ? window[FlashMovie] : document[FlashMovie];  }

             

            function TriggerMedia(mediaType,url)
                            {
                                if (mediaType==1)
                                {
                            
                                    alert(url);
                                    getFlashMovie("SkinTest1").sendURLToFlash("url");
                                   
                                }
                                  
                           
                            }
                           
            </script>


            </head>

             

            <body bgcolor="#ffffff">
            <!--url's used in the movie-->
            <!--text used in the movie-->
            <!-- saved from url=(0013)about:internet -->
            <!--<form name="htmlForm" method="POST" action="javascript:formSend();"> 
            Sending to ActionScript:<br /> 
            <input type="text" name="sendField" value="" /><br /> 
            <input type="submit" value="Send" /><br />  <br /> 
            Received from ActionScript:<br /> 
            <input type="text" name="receivedField"> </form> -->

             

            <input type=button value="Send" onclick="javaScript:TriggerMedia(1, 'Call_to_action.flv')"/>

             

             

             

            <script language="JavaScript" type="text/javascript">
                AC_FL_RunContent(
                    'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0',
                    'width', '800',
                    'height', '600',
                    'src', 'SkinTest1',
                    'quality', 'high',
                    'pluginspage', 'http://www.adobe.com/go/getflashplayer',
                    'align', 'middle',
                    'play', 'true',
                    'loop', 'true',
                    'scale', 'showall',
                    'wmode', 'window',
                    'devicefont', 'false',
                    'id', 'SkinTest1',
                    'bgcolor', '#ffffff',
                    'name', 'SkinTest1',
                    'menu', 'true',
                    'allowFullScreen', 'false',
                    'allowScriptAccess','always',
                    'movie', 'SkinTest1',
                        'flashvars','xmlFile=3DCarouselSettings.xml',
                    'salign', ''
                    ); //end AC code
            </script>
            <noscript>
                <object id="FlashMovie"  classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="800" height="600" id="SkinTest1" align="middle">
                <param name="allowScriptAccess" value="always" />
                <param name="allowFullScreen" value="false" />
                <param name="movie" value="SkinTest1.swf" />
                <param name="quality" value="high" />
                <param name="bgcolor" value="#ffffff" />
                <param name="flashvars" value="xmlFile=3DCarouselSettings.xml" />   
                <embed name= "FlashMovie" src="SkinTest1.swf" flashvars="xmlFile=3DCarouselSettings.xml" quality="high" bgcolor="#ffffff" width="800" height="600" name="SkinTest1" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />
               
                </object>
            </noscript>
            </body>
            </html>

             

             

             

             

             

            Thanks so much.....

            • 3. Re: passing value from js to as in a flvplayback component not working
              kglad Adobe Community Professional & MVP

              you must import the externalinterface class in as2:

               

              import flash.external.ExternalInterface;