making a button go through a set of arrays

a button on the screen and an input text box also on the screen .The user has to put a b or c in the input box that corrisponds to an 0 or 1
as the button is pushed it checks if caracter entered is a b or c -- the string (values) is converted to an array
if the value entered is not a b or c it will go to frame 31 that worn to use proper caracters
if a b or c entered is = to one it will goand stop to frame 11 telling correct
else it will go to frame 21 where it will say incorrect because the letter chosen is value 0!

this code is on the first frame of time liner

this code is on a button!
on(release) {
      if(((input.CharCodeAt(0)>64 && input.CharCodeAt(0)<68) || (input.CharCodeAt(0)>96
      && input.CharCodeAt(0)<100))) {
            for(var i=0;valuesArray.length;1++); {
                        if (input==valuesArray[i]);{
                        else {gotoAndStop(21);

else {
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sorry, I'm not seeing what the question is here.  This looks like a description of the code.  What is the issue you would like assistance with?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
>> if (input==valuesArray[i])

It doesnt make sense. You are comparing string "a","b" or "c" with "a=0", "b=0" and "c=0"
I agree with Savong, what exactly is the problem?

also, input - is that your var value or instance name?
I'm thinking u're using instance name as you're using CharAt etc, in which case you'll need input.text to get what the user has typed in.

try this code for the button:

on (release) {
      var frame_num:Number;
      if (((input.CharCodeAt(0)>64 && input.CharCodeAt(0)<68) || (input.CharCodeAt(0)>96 && input.CharCodeAt(0)<100))) {
            valuesArray = values.split(",");
            for (var i = 0; i<valuesArray.length; i++) {
                  if (input == valuesArray[i]) {
                        frame_num = 11;
                        // break for loop if correct
                  } else {
                        frame_num = 21;
      } else {
            frame_num = 31;
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.