# ЕventListener and sum vars problem

**URL:** <https://forum.kirupa.com/t/ventlistener-and-sum-vars-problem/267103>\
**Category:** flash\
**Created:** [July 28, 2008, 6:28pm UTC](https://forum.kirupa.com/t/ventlistener-and-sum-vars-problem/267103 "2008-07-28T18:28:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![spectator](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@spectator](https://forum.kirupa.com/u/spectator)\
**Post date:** [July 28, 2008, 6:28pm UTC](https://forum.kirupa.com/t/ventlistener-and-sum-vars-problem/267103/1 "2008-07-28T18:28:25Z")

</div>

I faced up a problem, with my code :(. I have a EventListener and a variable into it which I want to sum. The problem is that I can’t do that. Here is my code:

```auto
public function red() {
			this.buttonMode = true;
			koli4estvo.addEventListener(Event.CHANGE, onChange);
			edcena.addEventListener(Event.CHANGE, onChange);

			_obsuma = 0;
			_sravnenie = 0;
			
			var_listener();
			
			
			
function var_listener():void
{
if ((_sravnenie != _stoinost) && (_sravnenie > _stoinost)) ;
_sravnenie = _stoinost;

_oblag[_valuee] = _sravnenie;

 for (var i:Number= 0; i < _oblag.length; i ++)
 {
	
	_sum = _sum + _oblag*;
	trace (_sum);
 }

			}

		}
		private function onChange(event:Event):void {
			_koli4estvo = Number(koli4estvo.text);
			_edcena = Number(edcena.text);
			_stoinost = _koli4estvo * _edcena;
			rzl();
			
			
			
			function rzl():void
			{
			stoinost.text = String(_stoinost);
			_valuee = num.text;
			
			
			}
			

		}
		

```

I want to sum all the \_stoinost values I get :). Please help. 10x in advance 🙂
