Skip to main content
Participant
June 18, 2014
Question

I am trying to create a button which will move to the next scene when the input in 3 different input boxes are equal to a set value, how would I go about doing this?

  • June 18, 2014
  • 1 reply
  • 247 views

I'm a beginner at AS, so I apologise for that.

I'm assuming it has to do with the input in the input boxes being a variable, but I am unsure how to call in that variable into the actionscript on the button, as well as what actionscript to use. An If statement, I assume?

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
June 18, 2014

don't use the textfield variable.  assign instance names to your textfields (eg, tf1,tf2,tf3) and use their text properties:

function checkTF():Void{

if(tf1.text=="whatever1" && tf2.text=="whatever2" && tf.text=="whatever3"){

_root.gotoAndStop("framewhatever");  //<-use the goto methods and frame labels, not goto functions and scenes to navigate using actionscript.

}

}

Participant
June 19, 2014

I've just attempted this, but it didn't work. I don't think I'm calling in the text fields correctly.

I currently have the AS you gave me set on a button, so that's possibly why, any advice?

kglad
Community Expert
Community Expert
June 19, 2014

no code should be attached to objects.  attach all code to timelines, preferably the main timeline, and use object instance names to link code to objects.

eg, if your button has instance name btn,

btn.onRelease=checkTF;