I’m trying to use a “if statement” so that if a textfield is filled out before the timeline runs the end, the movie will go to a different scene than if the textfield is not filled out before the time runs out. Can any one please tell me how I can do that? THANK YOU!
On the last frame of the scene, do something to the effect of this pseudo-code:
if (isFilled(textField)) { // You'll need to define isFilled() with your check
// go to the scene
} else {
// go to the other scene
}
if (txtInstanceName.text!="") {
// go to the scene
} else {
// go to the other scene
}
what if i want to it go to another scene immediately after the textfield is filled up?
when you say filled do you mean the txtfield is going to gradually get more and more text in it until it reaches a certain point? or are you saying you want this to work as soon as any content gets put into the txtfield even one letter like “a” or whatever?
I meant when it reaches a certain point
TextField.length returns the number of characters in a texfield…you might want to use
if(TextField.length >= 100){
//do stuff
}
how do I use that with this code, because if I just simply plugging it in, somehow an error will pop up.
var characters:Array = new String(“two roads diverged in a yellow wood and sorry i could not travel both”).split("");
this.createTextField(“txt”, 1, 10, 260, 515, 22);
txt.border = true;
txt.background = true;
Key.addListener(txt);
txt.onChanged = function():Void {
Ferrari._x += 6.3;
};
txt.onKeyDown = function():Void {
if (String.fromCharCode(Key.getCode()).toLowerCase() == characters[txt.length].toLowerCase()) {
this.text += String.fromCharCode(Key.getCode());
this.onChanged();
}
}
:huh: i dunno