A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: keyword jump to frame

  1. #1
    Senior Member
    Join Date
    Feb 2002
    Posts
    101

    keyword jump to frame

    Hi all,

    I'm trying to create a movie, that when a correct word is entered, it goes to a specified frame. The code below words fine but I need to make an addition to it, which is where I need a bit of help…

    on (release, keyPress "<Enter>") {

    if (inputtext eq "word1") { gotoAndStop("frame1");

    } else if (inputtext eq "word2") { gotoAndStop("frame2");

    } else {
    inputtext = "";

    }
    }

    I was hoping to add extra words that would go to the same frame. I know I ca do this by…

    if (inputtext eq "word1") { gotoAndStop("frame1");
    } else if (inputtext eq "word3") { gotoAndStop("frame1");

    but was wondering if there is an easier way, something along the lines of…

    if (inputtext eq "word1", "word2", "word3") { gotoAndStop("frame1");

    Any ideas?
    jp

  2. #2
    Cancerbero
    Join Date
    Jan 2003
    Location
    Mexico City.
    Posts
    26
    As you are using "eq", I see you're programming in ActionScript 1. So, I suggest you to use the next line:

    Code:
    if (inputtext eq "word1" or inputtext eq "word2" or inputtext eq "word3") { gotoAndStop("frame1");
    In ActionScript 2, "eq" is replaced with "==", and "or" is replaced with "||" (double pipe). So, in AS2 your line code should be written like this:

    Code:
    if (inputtext == "word1" || inputtext == "word2" || inputtext == "word3") { gotoAndStop("frame1");
    Use the first line first, and if you have an error, try the second one.

    Let me know if it works.
    One idea. One emotion. One project.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center