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

How to make a button that controls the value of a dynamic text box

Guest
Jan 24, 2014 Jan 24, 2014

Hey fellas

I wanted to make a bill maker .. sort of for myself . I have a few products lets say and I would like to click on them and by clicking on those buttons I would to see numbers add up in a dynamic text box and so I could keep track of the value inside the box.

Lets say we have 2 buttons . by clicking the 1st and 2nd I want to get 12 in my text box and by clicking 2nd and 1st I would like to get 21 in my box .

Is this atall possible with AS2 ?

please guide me through

Thanks.

TOPICS
ActionScript
422
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

correct answers 1 Correct answer

Community Expert , Jan 24, 2014 Jan 24, 2014

sure:

tf.text=""; //tf is your textfield that displays the results of your movieclip button clicks

for(var i:Number=0;i<9;i++){

this["btn_"+i].ivar=i;  // use movieclip buttons btn_1, btn_2,..,btn_9

this["btn_"+i].onRelease=btnF;

}

function btnF():Void{

tf.text+=this.ivar;

}

Translate
Community Expert ,
Jan 24, 2014 Jan 24, 2014
LATEST

sure:

tf.text=""; //tf is your textfield that displays the results of your movieclip button clicks

for(var i:Number=0;i<9;i++){

this["btn_"+i].ivar=i;  // use movieclip buttons btn_1, btn_2,..,btn_9

this["btn_"+i].onRelease=btnF;

}

function btnF():Void{

tf.text+=this.ivar;

}

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