Flash Advisor logo
:: Desktop Shortcut
:: Flash Help
Advice from Experts

Closed Thread
Results 1 to 2 of 2
  1. #1

    Post Help with a text processing script

    Hi,
    A newbie to flash all assistance welcome!

    I am having problems writing simple script that

    1) Takes input from the keyboard
    2) Checks the input against a specified string (including formatting chars)
    3) If the input matches the current letter within a string then display the char in a text box.
    Else play a .wav file.

    I am able to trigger a .wav file but am struggling with the 1-3.

    Hope someone can help

  2. # ADS
    Join Date
    Always
    Posts
    Many
     
  3. #2
    Join Date
    Feb 2008
    Posts
    570

    Default

    Code:
     
    myListenerDown = new Object();
    myListenerDown.onKeyDown = function () {
     if(Key.isToggled(Key.CAPSLOCK) || Key ==(Key.SHIFT)){
      capsOn = true;
      }else{capsOn = false;}
     
    // change character to upper or lower case
     if(capsOn){
      lastKeyPressed = chr(Key.getCode());
      }else{lastKeyPressed = chr(Key.getAscii());}
     
    //check to see if the key pressed is in string 
    if(checkString.indexOf(lastKeyPressed) > -1){
      my_text.text = lastKeyPressed;
     }else{//play .wav file}
    }
     
    checkString = "AbCd";
    var capsOn = false;
     
    Key.addListener(myListenerDown);
    Last edited by blitzzz; 09-04-2008 at 10:02 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Sponsors
Create Speaking Characters for your website and Flash movies. 15 Day Free Trial