Hi
I need your help with following problems!!!
How to add numbers??
I have textfield with instance “field1” and two buttons with following script
onRelease = function(){
_root.field.text =1;
}
how do I add the sum when second button clicked and not insert value 1 again?
I tried this way but didn`t work
onRelease = function(){
_root.field.text =add.1;
}
and here is the code
c1.onMouseDown = function() {
_root.field.text += 1;
};
…maybe I didn`t specify my problem clearly…sorry for that
…
button1 holds a value of 1
button2 also hold the value of 1
…
when button1 is released…value one is inserted in textfield
now when button2 is released…the textfield should have value of 2
…adding the sum…from previous state.
this is because when using the .text value(instance names), flash doesnt like adding, unless you use field.text++; but you should use += because then you can add not only one, when only adding one however, use ++ because it’s faster;)
still not working:(
field.text = myVar=0;
c1.onMouseDown = function() {
field.text = myVar += 1;
trace (myVar);
};
// output 2…how come? when myVar set to 0 and adding 1 to it would be 1