Your right. I am passing a string.
But I'm trying to use that string to access an array by the same name.
someArray = { label: "my text" };
showPopup("someArray"); // send a string which is the name of my array
in the function:
myDynamicText.text = myArray["label"]; // try to use the passed
string to access the array.
This won't access some array. How do I convert that string over to
something that will work?
-b
On Mar 12, 2007, at 3:46 PM, Andy Herrman wrote:
I think this is your problem:
showPopup("myarray");
You're passing showPopup a string with the value "myarray", not the
array. Remove the quotes and you should be good.
-Andy
On 3/12/07, Bill Abel <[EMAIL PROTECTED]> wrote:
How do you access an associate array using a variable?
Inside my function popup["text"]; won't access the array. I can't
find any information in the books I have Actionsript Cookbook and
Actionscript for Flash MX.
Anyone dealt with this before?
// Define the text and titles for the popups
var myarray = { text: "Lorem ipsum dolor sit amet ..." };
// Testing - this works!
trace(myarray["text"]);
// Show the popup
function showPopup(popup) {
mainMap[popup].gotoAndPlay("on");
mainMap[popup].label_title.text = popup["text"]; // This
doesn't work.
trace(popup["text"]);
};
showPopup("myarray");
_______________________________________________
[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