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
<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