2 Replies Latest reply on Sep 4, 2010 10:05 AM by shawn234

    array loop to change variables?


      The plan is to set up variables to react to a flashvars value like this:
      [code=html]<param name="flashvars" value="mainVars=1" />[/code]


      var videoArray:Array;
      var videoTitle:String;
      var videoFile:String;




      function onEnterFrame(){
          for(var i=videoArray.length-1;i>0;i++){
                      videoTitle="Show the video's change";
                  else if(i==1){
                      videoTitle="This is the second one";


      There would be many mainVars (over 100, actually) and this setup isn't working.  Could someone please help fix this problem?


      Message was edited by: shawn234

        • 1. Re: array loop to change variables?
          kglad Adobe Community Professional & MVP

          there are so many problems it's hard to tell what you want to do.


          but to start:


          1.  you almost certainly don't want to use an enterframe loop there

          2.  the parameter i should be decrementing, not incrementing

          3.  _root.mainVar is not the same as mainVars

          4.  you almost certainly don't want to use a while-loop there

          • 2. Re: array loop to change variables?
            shawn234 Level 1

            Oops, the mainVars was a typo.


            What I want to have as the finished product is a video page of multiple video players, each player with a different mainVar value.  The mainVar would tell the videoArray what to change the simplified videoTitle and videoFile variables to.


            That's the plan.  I don't know how to impliment it.  I figured an array would be a good choice since the array can have infinite "i" values, but I could be horribly wrong...