# \[MX\] Dynamically named variables!

**URL:** <https://forum.kirupa.com/t/mx-dynamically-named-variables/31048>\
**Category:** flash\
**Created:** [September 17, 2003, 6:22pm UTC](https://forum.kirupa.com/t/mx-dynamically-named-variables/31048 "2003-09-17T18:22:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lrhb](https://avatars.discourse-cdn.com/v4/letter/l/e47774/32.png) [@lrhb](https://forum.kirupa.com/u/lrhb)\
**Post date:** [September 17, 2003, 6:22pm UTC](https://forum.kirupa.com/t/mx-dynamically-named-variables/31048/1 "2003-09-17T18:22:39Z")

</div>

Hello all,

Obviously I’m trying to do something and doing it wrong (again)…

The idea is: Dynamically named Object, with a dynamically named Array, with a dynamically named Array.

[AS]function sortData(stateAbbr){  
menuItem = “menu” + stateAbbr;  
this[menuItem] = new Array();  
for (i=1; i\<queryResults.getRowCount();i++){  
store = “store” + i;  
this[menuItem][store] = new Object();  
this[menuItem][store].name = queryResults.getField(i, “STORENAME”);  
this[menuItem][store].city = queryResults.getField(i, “ADDRESSCITY”);  
}  
}[/AS]

So, if stateAbbr = “CA”, i should be able to say: trace (menuCA.store3.name); and get back whatever is held there, right?

When I started up Flash, it told me, “Fear not the ob-stacles in your way, for fate has vouchsafed your reward”. I don’t know exactly what that means, other than maybe I’ve been spending too much time with Flash…

As always, advice graciously accepted! Thanks in advance!

lrhb :hat:
