# Help with defining a function to increase or decrease a number

**URL:** <https://forum.kirupa.com/t/help-with-defining-a-function-to-increase-or-decrease-a-number/183185>\
**Category:** Uncategorized\
**Created:** [March 24, 2006, 1:48pm UTC](https://forum.kirupa.com/t/help-with-defining-a-function-to-increase-or-decrease-a-number/183185 "2006-03-24T13:48:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![72monkeys](https://avatars.discourse-cdn.com/v4/letter/7/e36b37/32.png) [@72monkeys](https://forum.kirupa.com/u/72monkeys)\
**Post date:** [March 24, 2006, 1:48pm UTC](https://forum.kirupa.com/t/help-with-defining-a-function-to-increase-or-decrease-a-number/183185/1 "2006-03-24T13:48:40Z")

</div>

Situation:

1. The are two buttons
2. If you click the first one a number is increaded by 1
3. If you click the second one the same number gets decreased by 1
4. For each there is an IF statement which starts a certain action

I can’t figure out how to make this work. The following script returns only one number and thus starts only on action:

function ClipSelector(i:Number):Number {  
i++;  
return i;  
}  
var nDummyVar:Number = 0;  
var nSelectorValue:Number = ClipSelector(nDummyVar);  
if (nSelectorValue == 1) {  
trace(“blah”);  
}  
else if (nSelectorValue == 1) {  
trace(“blah”);  
}  
//output: bla

---

<div class="post-metadata">

**Author:** ![72monkeys](https://avatars.discourse-cdn.com/v4/letter/7/e36b37/32.png) [@72monkeys](https://forum.kirupa.com/u/72monkeys)\
**Post date:** [March 24, 2006, 1:53pm UTC](https://forum.kirupa.com/t/help-with-defining-a-function-to-increase-or-decrease-a-number/183185/2 "2006-03-24T13:53:59Z")

</div>

BTW there is second button in this script but i need to include too
