A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Condition Statment Ignored?

  1. #1
    Senior Member
    Join Date
    Jun 2001
    Posts
    250

    Condition Statment Ignored?

    Hello,


    I'm attempting to cycle through an array one value at a time a display each resule in a field "field1"
    This part of the code functions ok.

    My problem arise when I test for a condition in field1 or field2.
    The condition statments are totally ignored?


    //INT
    //cycle through array
    var step=0;
    var varray = new Array("start",1,2,3,4,5);
    var field2 = 4;

    function fstep(){
    step+=1;
    trace(step);
    //loop array[step]
    for(i=0; i<=varray.length; i++){

    if(step>=varray[i]){
    trace("varray=" +varray[step]);
    field1=varray[step];
    break;


    //Condition statement ignored???

    //if exceed array last value do the following...
    if(field2>=4){
    trace("page number exceeded!");
    field2="test";//or last value in array
    }
    }
    }
    }


    Or better yet, does someone have better method to cycle throuhg an array?

    iaustin

  2. #2
    I'm not exactly sure what you're trying to do there but if you just want to cycle through an array here ya go:

    Code:
    var varray = new Array(1, 2, 3, 4, 5);
    
    function cycle() {
    	for(i=0; i<varray.length; i++){
    		trace(varray[i]);
    	}
    }

  3. #3
    Member
    Join Date
    Sep 2004
    Location
    Columbia, MD
    Posts
    60
    can you post an fla? It is difficult to debug code if you don't know what timeline everything is on...

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