# \[cs4\] array loop to change variables?

**URL:** <https://forum.kirupa.com/t/cs4-array-loop-to-change-variables/313617>\
**Category:** flash\
**Created:** [September 4, 2010, 4:35pm UTC](https://forum.kirupa.com/t/cs4-array-loop-to-change-variables/313617 "2010-09-04T16:35:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sg123](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@sg123](https://forum.kirupa.com/u/sg123)\
**Post date:** [September 4, 2010, 4:35pm UTC](https://forum.kirupa.com/t/cs4-array-loop-to-change-variables/313617/1 "2010-09-04T16:35:11Z")

</div>

The plan is to set up variables to react to a flashvars value like this:

```auto
<param name="flashvars" value="mainVars=1" />

```

```auto

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

videoArray=[0,1];

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

```

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