Cool. That's it. Thanks so much!
Needed to use the syntax;
this[myStringVariableAndArrayName]["myLabelInMyAssociativeArray"];
My final code:
// Show the popup
function showPopup(popup) {
trace(popup);
mainMap[popup].gotoAndPlay("on");
mainMap[popup].label_title.text = this[popup]["labelText"];
trace(this[popup]["labelText"]);
};
On Mar 12, 2007, at 4:45 PM, Merrill, Jason wrote:
How do you do it where myVar is the array? Is this possible?
Or do you always have to specify the array?
Easy, just keep using the array access operator to evaluate:
myVar = "myArray2"
myArray1 = new Array()
myArray1["elem1"] = "hello"
myArray1["elem2"] = "hi"
myArray2 = new Array()
myArray2["elem1"] = "wassup"
myArray2["elem2"] = "yo"
trace(this[myVar]["elem1"]) //traces "wassup"
Jason Merrill
Bank of America
Global Technology & Operations
Learning & Leadership Development
eTools & Multimedia Team
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf
Of Bill Abel
Sent: Monday, March 12, 2007 5:02 PM
To: [email protected]
Subject: Re: [Flashcoders] Accessing an Associative Array
How do you do it where myVar is the array? Is this possible?
Or do you always have to specify the array?
arr = new Array()
arr["elem1"] = "hello"
arr["elem2"] = "hi"
function testArray(myVar) {
trace(myVar["elem2"]);
};
testArray(arr);
On Mar 12, 2007, at 3:17 PM, Merrill, Jason wrote:
arr = new Array()
myVar = "elem2"
arr["elem1"] = "hello"
arr["elem2"] = "hi"
trace(arr[myVar])
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com