Compare two different arrays in Actionscript 3 using For Loop within a For Loop

basically I need a loop within a loop to compare two different arrays in my actionscript3 lottery game. I have attempted the loop but I cannot seem to get it to work ...

check_win.addEventListener(MouseEvent.CLICK, f_check_win);
function f_check_win(event:Event):void{ 
for(index = 0; index < matches[index]; index++ ){
trace(index);
    for(index2 = 0; index2 < input_array.length; index2++){
        if (match[index2] == input_array[index2]){
            choose_change = choose_change+1;
        }
    }
}

So basically within this code check_win is a button. Once the button is clicked it runs the loop. It is meant to take an instance of matches which contains 6 properties and loop until index is greater than matches. According to my output this is happening but the second loop doesn't appear to do anything. Any help is greatly appreciated.

Answers


Based on the code you've provided, it looks like your inner loop should look more like this:

for(index2 = 0; index2 < input_array.length; index2++){
    if (matches[index] == input_array[index2]){
        choose_change = choose_change+1;
    }
}

Need Your Help

TopMost not working when tabbing

c# winforms

A few minutes ago I encountered a weird problem with TopMost. I created a topmost form (WinForms) did some tabbing and everything was fine.

Android camera, save image then display the image

android android-intent android-camera android-camera-intent

I'm trying to take an image, store the filpath in a global variable, and then display a thumbnail. But it fails to display the image after the image has been saved.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.