3 Replies Latest reply on Nov 8, 2013 6:12 AM by kglad

    loadmovienum example with variables


      this is for AS 2

      I have an existing loadmovienum() call that I need to modify to pass variables to the called .swf

      Can't seem to find an example for both the call and then reading/accessing the variables passed

      I have the sytax, loadMovieNum(url:String, level:Number [, variables:String])

      but can't find a practical example of what exactly is 'variables:String' and then how to read those variables.

      the existing call is like this, loadmovienum("some.swf, 5) so its loading movie 5 which I don't want to change,

      just add 2 variables

      Then in the startup in some.swf I need to access the passed variables for use throughout program,

      move them to some local variable in some.swf?

      If somebody has a link to an example or more comprehensive documentation please post


      <moved by mod from actionscript 3 forum - kglad>

        • 1. Re: loadmovienum example with variables
          kglad Adobe Community Professional & MVP



          loadMovieNum(url, levelnum, "GET");


          you can then append the variables/values to the url in a query string.  parse the query string using the _url property in the receiving swf.




          loading swf:




          loaded swf:


          var s:String = this._url.split("?")[1];

          //tf is textfield on stage used to display the variables/values.

          tf.text = "";

          var varVal:Array = s.split("&");

          for(var i:Number=0;i<varVal.length;i++){

              tf.text += varVal[i].split("=")[0]+" has value = "+varVal[i].split("=")[1]+"\n";


          • 2. Re: loadmovienum example with variables
            bbxrider1 Level 1

            wow, above and beyond  the call of duty!

            first off for how to get (no pun intended) the url string and then the extra mile with the splitting and unstringing the parms

            I even got to create the passed variables from other variables sent to the 1st .swf from a calling .asp.


            asp calls prog-1 with other data it gathers up


                     + '<EMBED src="'+ prog1.swf + varString + '"'



            prog1.swf calls prog2.swf

            loadMovieNum ("prog2.swf?var1FromVarString=" + var1 + "?var2FromVarString=" + var2, 5, "GET");


            there is also quite a bit of additional info after whatever vars I sent, it took a couple of trys to figure out I didn't need to put  the 2nd & after my 2 vars, that gets put on automagically


            many many thanks for your excellent helpl

            • 3. Re: loadmovienum example with variables
              kglad Adobe Community Professional & MVP

              you're welcome.