Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 238
  • Last Modified:

Cross check 2 input boxs

I have two input boxes on a frame, one called Rand and the other called Guess. Both contain a six digit number. What I want to do is cross check the two input boxes to see how many digits are the same in the two boxs. If all are correct I want an output of 6 and if 2 are the same i want an output of 2 etc.

Here is the code i have so far but it is not working.

var Rand:String = "";
var Guess:String = "";
counter = 0;
for (i=0; i<Rand.length; i++) {
     if (Guess.charAt(i) == Rand.charAt(i)) {
          counter++;
          trace(counter);
     }
}
0
lukegriffiths110
Asked:
lukegriffiths110
  • 2
1 Solution
 
BillystyxCommented:
You need to have a value in your string. You get this from your textfields, using the variable names you gave them.

Rand1= String(Rand); //where rand1 is the variable name of your generated text field

Billystyx
0
 
BillystyxCommented:
and Guess1=String(Guess);

where Guess is the variable name of you rinput field (and in previous post Rand is the name of the variable in the generated text field for the lottery number)

Billystyx
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now