Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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?

New Here ,
Jun 18, 2014 Jun 18, 2014

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?

TOPICS
ActionScript
231
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 18, 2014 Jun 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.

}

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 19, 2014 Jun 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 19, 2014 Jun 19, 2014
LATEST

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;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines