making a button go through a set of arrays

Posted on 2004-11-30
Last Modified: 2010-04-03
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 {
Question by:andreafp
    LVL 10

    Accepted Solution

    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?
    LVL 5

    Expert Comment

    >> if (input==valuesArray[i])

    It doesnt make sense. You are comparing string "a","b" or "c" with "a=0", "b=0" and "c=0"
    LVL 39

    Expert Comment

    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.

    LVL 5

    Expert Comment

    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;

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
    This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
    The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
    The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now