Variables for a Keypad
Sep 24, 2012
I was getting along with variables so well. Had everything working the way I wanted. But now? I've run into a brick wall.
What I want to do is have a numeric keypad on screen, which, when you click a number on the keypad, will appear in a window at the top. That's all well and good for individual numbers, but if I press a 1 and then a 2, it won't add the 2 beside the one, obviously, it will replace it.
I've thought and thought and thought about it, and the only solution I can come up with at the moment is creating a variable for any number combination possible, which would be incredibly tedious and take eons. Are there any other options, or should I scrap the idea?
I've done some searching on the forums here for ideas for a calculator, and I'm hoping for some other option besides finding a Flash calculator.
7 Replies
Hi Ashley this quite easy, set a trigger to multiply by one then add 2
so each button has a multiply by ten trigger first, then add the value of the button
Not my idea, Dave Mozealous came up with it, he also created a calculator but it does not support decimals (these are rather tricky and probably need to be done in javascript)
Run that by me one more time? Multiple by One or 10?
On each button 1-9, 0
You have two triggers the first multiplies your variable by ten, the second adds the value of that button to the variable.
e.g
You press 1, 1x0 (the initial value of your variable)= 0 + 1, hence the value displayed is 1
You then press 2, 1 (the current value of the variable) x 10 = 10, + 2, display shows 12
Gotcha! Oh wow, this is awesome. Thank you so much.
So there's no way to get the decimal place to appear, eh? That's alright. What about a backspace button, though?
Decimals are not really possible, backspace would also be problematic. Both could be achieved using javascript
Ah ok. I haven't the slightest idea where to even begin with javascript XD, we'll leave that for another day.
This discussion is closed. You can start a new discussion or contact Articulate Support.