# Array troubles

**URL:** <https://forum.kirupa.com/t/array-troubles/181576>\
**Category:** Uncategorized\
**Created:** [March 10, 2006, 2:40pm UTC](https://forum.kirupa.com/t/array-troubles/181576 "2006-03-10T14:40:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![binime](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@binime](https://forum.kirupa.com/u/binime)\
**Post date:** [March 10, 2006, 2:40pm UTC](https://forum.kirupa.com/t/array-troubles/181576/1 "2006-03-10T14:40:48Z")

</div>

im making a flash iventory system for my RPG.

Firstly the flash file gets an XML file which holds the users inventory.

The XML is parsed.

the XML looks like

```auto
 
<inventory>
 <inventory_item>
  <inv_type>Weapon</inv_type>
  <baseurl>http://localhost/index.php?</baseurl>
  <url>http://localhost/</url>
  <weapon_id>2</weapon_id>
  <weapon_img>/images/rpg/weapons/92eef6db7007b352af6d204fa43e62db43f484f3bab7f.gif</weapon_img>
  <weapon_desc>This shiny sword is made out of light-weight material making it easy to swing. It is the most common form of defence amongst villagers and even novice warriors use it.</weapon_desc>
  <weapon_level>3</weapon_level>
  <weapon_title>Shiny Sword</weapon_title>
  <weapon_stats>
   <stat>
    <stat_id>9</stat_id>
    <stat_value>3</stat_value>
   </stat>
   <stat>
    <stat_id>1</stat_id>
    <stat_value>4</stat_value>
   </stat>
   <stat>
    <stat_id>6</stat_id>
    <stat_value>1</stat_value>
   </stat>
   <stat>
    <stat_id>4</stat_id>
    <stat_value>1</stat_value>
   </stat>
  </weapon_stats>
 </inventory_item>
</inventory>

```

ok, now my array variable is

weaponStats

in php the outcome would look like

$weaponStats[$weapon\_id][$stat\_id] = $stat\_value;

however, it doesnt work in flash. it doesnt register all the stat values for that specific stat.

i have traced the stat\_value and stat\_id and it works, it just doesnt when i put it into an array.

Other methods i have tried are

weaponStats[weapon\_id] = new Array();  
weaponStats[weapon\_id][stat\_id] = stat\_value;

i have tried making weaponStats[weapon\_id] an object and that still hasnt worked.

Can anybody help?!  
Any help would be much appreciated.

Thanks
