I am trying to get this result:
You can type a number in a TLF textfield
var a:int
a=100
totalScore.text = String (typedNumber-=a)
Say you typed 40. The result would be 60.
I tried this:
var inzet_blackjack:Number = 0;
var inzet_blackjack:TextField = eval("myInput"+inzet_blackjack);
totalScore.text = String (inzet_blackjack-=a) //inzet_blackjack = typedNumber
so basically I am trying to save the number in the textfield as an Integer
this is the error I am getting:
Scene 1, Layer ‘Layer 1’, Frame 6, Line 138 1151: A conflict exists with definition inzetBlackjack in namespace internal.
EDIT: I see that I am also using Action Script 2.0 again. But Its supposed to be in ActionScript 3.0.. ^^
You are getting that error because you have two variables with the same name.
inzet_blackjackis used for your number and your textfield. Give them different names to fix that error.To treat a value from a text field as a number you need to cast it as such. Here is an example:
Also note that AS3 has no eval function.