Variable identifiers are not string constants, so:
showPopup(myarray);
However mainMap[popup].gotoAndPlay("on"); has no sense in this case,
since the array notation excepts a string and not an object. Ans also
you don't need to use array notation here at all, the simple dot
syntax is enough: myarray.text and popup.text
Attila
BA> How do you access an associate array using a variable?
BA>
BA> Inside my function popup["text"]; won't access the array. I can't
BA> find any information in the books I have Actionsript Cookbook and
BA> Actionscript for Flash MX.
BA>
BA> Anyone dealt with this before?
BA>
BA> // Define the text and titles for the popups
BA> var myarray = { text: "Lorem ipsum dolor sit amet ..." };
BA>
BA> // Testing - this works!
BA> trace(myarray["text"]);
BA>
BA> // Show the popup
BA> function showPopup(popup) {
BA> mainMap[popup].gotoAndPlay("on");
BA> mainMap[popup].label_title.text = popup["text"]; // This doesn't work.
BA> trace(popup["text"]);
BA> };
BA>
BA> 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