[cs4] array loop to change variables?

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

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

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?