# \[MX2004\] problem with displaying numeric variables

**URL:** <https://forum.kirupa.com/t/mx2004-problem-with-displaying-numeric-variables/127098>\
**Category:** Uncategorized\
**Created:** [October 30, 2004, 9:17am UTC](https://forum.kirupa.com/t/mx2004-problem-with-displaying-numeric-variables/127098 "2004-10-30T09:17:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![botulism](https://avatars.discourse-cdn.com/v4/letter/b/a183cd/32.png) [@botulism](https://forum.kirupa.com/u/botulism)\
**Post date:** [October 30, 2004, 9:17am UTC](https://forum.kirupa.com/t/mx2004-problem-with-displaying-numeric-variables/127098/1 "2004-10-30T09:17:10Z")

</div>

hey there,

I’m new to this forum, and new to flash MX (I have used flash 4 back in the days, but that was about 3 or 4 years ago, so my knowledge has sadly disappeared). But I know a little javaScript, so I do vaguely understand most of the Action Script commands… just don’t know how to use them.

I am working on a file that displays two variables, a and b. The two variables are percentages, and they both start at value 50.  
Now what i want to do is to display both variables, and when the user presses the ‘up’ key a should go up and b should go down. When the user presses the ‘down’ key, it should be the other way around. And a+b= always 100.

I made this little action script:

[FONT=Courier New]  
var a:Number = 50;  
var bNum:Number = 50;  
if(Key.getCode() == Key.UP) {  
a++;  
b–;  
return a;  
return b;}

if(Key.getCode() == Key.DOWN) {  
a–;  
b++;  
return a;  
return b;}[/FONT]

Then I’ve made two text areas, both in their own layer. I’ve put them both on ‘dynamic text’ and where it read ‘Var:’, I have entered ‘a’ for the first and ‘b’ for the second. In both text areas, I entered ‘50’

Obviously, it doesn’t work. I test the movie, and nothing happens when I press the ‘up’ or ‘down’ keys.

If anyone could please help me out…!
