#1
  1. PHP Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Location
    England
    Posts
    163
    Rep Power
    13

    Flash and integers/ arrays :(


    I have an array with the following in:

    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 512 1231 763 167 1624 736 3243 643 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

    I am trying to find the highest num, I am using the code below:

    but it keeps returning 763 as the highest.



    Code:
    var High = 0;
    	for(i=0;i<=GCount.length;++i)
    	{
    		text = text + GCount[i] + " ";
    		if(GCount[i] > High)
    		{
    			High = GCount[i];
    		}
    	}
    Thanks
  2. #2
  3. PHP Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Location
    England
    Posts
    163
    Rep Power
    13
    Wow, just fixed it thanks.

    WEas a data type issuse. had to put int() round the variables as they were coming from XML.

    Code:
    var High = 0;
    	for(i=0;i<GCount.length;i=i+1)
    	{
    		text = text + GCount[i] + " ";
    		if(int(GCount[i]) > int(High))
    		{
    			High = int(GCount[i]);
    		}
    	}


IMN logo majestic logo threadwatch logo seochat tools logo