A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: AS2 - array loop to change variables?

  1. #1
    Junior Member
    Join Date
    May 2009
    Posts
    10

    Unhappy AS2 - array loop to change variables?

    The plan is to set up variables to react to a flashvars value like this:
    Code:
    <param name="flashvars" value="mainVars=1" />
    Code:
    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?

  2. #2
    Junior Member
    Join Date
    Sep 2010
    Posts
    6
    It would probably be easier to load that many variables in a XML file. The XML file obviously can be created dynamically. I think that would be the easiest, simplistic, way to accomplish what you what to accomplish.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center