Be a Supporter!

autorefresh text fields

  • 208 Views
  • 4 Replies
New Topic Respond to this Topic
DikkeHamster
DikkeHamster
  • Member since: Aug. 22, 2007
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
autorefresh text fields 2010-07-25 10:06:15 Reply

Hello, I'm a real nub when it comes to actionscript.
I'm trying to make some sort of calculator but I dont know how I can
change the output in my dynamic text field when a value from the input changes.

Is this with on(change) or something?
And how do I script with text fields?
I have experience in Java and C and I'm using AS2.0 because otherwise I couldn't
give variables to my text fields and CS5.


BBS Signature
Spysociety
Spysociety
  • Member since: Dec. 30, 2009
  • Offline.
Forum Stats
Member
Level 21
Blank Slate
Response to autorefresh text fields 2010-07-25 10:29:11 Reply

At 7/25/10 10:06 AM, DikkeHamster wrote: Hello, I'm a real nub when it comes to actionscript.
I'm trying to make some sort of calculator but I dont know how I can
change the output in my dynamic text field when a value from the input changes.

Is this with on(change) or something?
And how do I script with text fields?
I have experience in Java and C and I'm using AS2.0 because otherwise I couldn't
give variables to my text fields and CS5.

I'm also doing a calculator, for do the calculated number I did:

var calculated:Number = 0;

Than for add the number I did:

one_num.onPress = function(){
	_root.keyOn = "one";
	if(keyOn == "one"){
		add_num.onPress = function(){
			_root.calculated = calculated + 1;
		}
		less_num.onPress = function(){
			_root.calculated = calculated - 1;
		}
}

What I did was, that pressing "1" on the calculator, it activate the variable keyOn, than keyOn identify for me what number is, so I did "one", than if is one, pressing on the button with "+" he add 1 and pressing on the button with "-" he subtract 1. I also did division and multiplication, than you use / and *.

Hope this helped.
SpyS.

DikkeHamster
DikkeHamster
  • Member since: Aug. 22, 2007
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
Response to autorefresh text fields 2010-07-25 10:34:04 Reply

Hmm, but I don't want to work with any buttons, maybe just a reset one.

And it's not really a mathematical calculater, it's for an mmo.
So one just needs to fill in how many units of this gives that amount of rating.

Anyway, thanks, maybe I can still use your method!


BBS Signature
Spysociety
Spysociety
  • Member since: Dec. 30, 2009
  • Offline.
Forum Stats
Member
Level 21
Blank Slate
Response to autorefresh text fields 2010-07-25 11:06:49 Reply

At 7/25/10 10:34 AM, DikkeHamster wrote: Hmm, but I don't want to work with any buttons, maybe just a reset one.

And it's not really a mathematical calculater, it's for an mmo.
So one just needs to fill in how many units of this gives that amount of rating.

Anyway, thanks, maybe I can still use your method!

For the reset button like the "Ce" from the calculator is pretty simple, is just:

ce_btn.onPress = function(){
         _root.calculated = 0;
}

SpyS.

ProfessorFlash
ProfessorFlash
  • Member since: Oct. 6, 2007
  • Offline.
Forum Stats
Member
Level 32
Programmer
Response to autorefresh text fields 2010-07-25 11:46:15 Reply

At 7/25/10 10:34 AM, DikkeHamster wrote: Hmm, but I don't want to work with any buttons, maybe just a reset one.

And it's not really a mathematical calculater, it's for an mmo.
So one just needs to fill in how many units of this gives that amount of rating.

Anyway, thanks, maybe I can still use your method!

I think you need to explain better in detail what you are trying to do. Your first post indicates that you want to make a calculator, i.e. where user inputs numbers and the calculator outputs the result. But this post now seems to indicate something different. So please explain better what you exactly want to do.


You can solve pretty much any problem you may have with AS3 by consulting the AS3 Language reference.