# Adding values of an array

**URL:** <https://forum.kirupa.com/t/adding-values-of-an-array/268428>\
**Category:** flash\
**Created:** [August 13, 2008, 6:19pm UTC](https://forum.kirupa.com/t/adding-values-of-an-array/268428 "2008-08-13T18:19:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pixel\_chick](https://avatars.discourse-cdn.com/v4/letter/p/eada6e/32.png) [@pixel\_chick](https://forum.kirupa.com/u/pixel_chick)\
**Post date:** [August 13, 2008, 6:19pm UTC](https://forum.kirupa.com/t/adding-values-of-an-array/268428/1 "2008-08-13T18:19:08Z")

</div>

I have a list of values that I loop though and stuff into an array. Once they are in the array, I would like to add all of the values together (they are all numbers). There will always be a different number of values in the array so it needs to be done dynamically. Can anyone point me in the right direction?

var animalCountArr:Array = new Array();  
var animalCount:XMLList = xmlData.row.(animalID == r && animalType == “DOG” && countyID == 40);  
for (var v:uint = 0; v\<animalCountArr.length(); v++) {  
animalCountArr[v] = animalCount.calcCandidateVotes[v];  
}

Thanks.
