Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Input Text

Status
Not open for further replies.

llldnylll

Technical User
May 21, 2003
89
I don't know if my explination is good enough, but lets give it a shot...

I am trying to make an Input box, so that when the user enters certain text (has to be exact) it goes to next screen if not, nothign happens.

So, if they are suppose to enter "BLUE" then it goes to next screen if they enter "RED" nothin happens untill they have it correct.

Thanks in advance.

 
Create a submit button with an instance name "submit".

Code:
submit.onRelease = function(){
   if(instanceNameOfTextBox.text == "BLUE"){
      gotoAndPlay(2);
   }
}

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
I think he wants it to be automatic - is there any type of onChange with the input as with javascript?

[conehead]
 
Is there a way to do it without having a button?



 
You can do it when the text box loses focus...

Code:
instanceNameOfTextBox.onKillFocus = function(){
   if(instanceNameOfTextBox.text == "BLUE"){
      gotoAndPlay(2);
   }
}

or onChange

Code:
instanceNameOfTextBox.onChange = function(){
      if(instanceNameOfTextBox.text == "BLUE"){
      gotoAndPlay(2);
   }
}

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
I can't get it to work :-(

Am I suppose to stick the code on the button?
This is what I have...
Code:
on (release) {
    submit.onRelease = function() {
        if (box.text == "Blue") {
            gotoAndPlay(3);
        }
    };
}


 
e.g.

call a button on the stage submit:

then put the following code on the TIMELINE actions frame, not the button's:

Code:
submit.onRelease = function() {
        if (box.text == "Blue") {
            gotoAndPlay(3);
        }
    };



Regards,

Martin

Gaming Help And Info:
 
So on frame 1 of the timeline that holds the submit button on an "actions" layer your code should be something like:

(if you don't want to use a submit button)

Code:
instanceNameOfTextBox.onChange = function(){
      if(instanceNameOfTextBox.text == "BLUE"){
      gotoAndPlay(2);
   }
}


Wow JT that almost looked like you knew what you were doing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top