PDA

View Full Version : Array Output Inquiry


madcat
04-12-2002, 06:00 PM
--When I create this code::

--------->

settings = ["on", "off"];

options = settings.concat(["brightness", ["high", "medium", "low"]]);

trace(options);

--------->

The ouput window shows: on, off, brightness, high, medium, low

--It is suppose to output ["on", "off", "brightness", ["high", "medium", "low"]]

NOT: ["on", "off", "brightness", "high", "medium", "low"]

--Is that what's happening, but the output window is just unable to display it like that? Hopefully you see what I mean.

Thanks

Grifter
04-12-2002, 06:24 PM
i think you just need to shift the quotation marks around the square brackets (but if you want it to display ["high"...] i'm not sure if flash will get confused with the quote marks). so just change the code to this if you're happy not having the extra quote marks:
settings = ["on", "off"];

options = settings.concat(["brightness", "[high, medium, low]"]);

trace(options);

hope this helps
Grifter

red penguin
04-12-2002, 06:28 PM
If you list your variables you get this for options...Which is what you are expecting to see, right?

Variable _level0.options = [object #2] [
0:"on",
1:"off",
2:"brightness",
3:[object #3] [
0:"high",
1:"medium",
2:"low"
]

CTRL+ALT+V ...

madcat
04-12-2002, 06:36 PM
CTRL + ALT + V --> That's new to me;) Cool. Appreciate.

tg
04-12-2002, 07:58 PM
list variables is great... to make it work while your running do:

trace(options.join());

madcat
04-12-2002, 08:41 PM
settings = ["on", "off"];

options = settings.concat(["brightness", ["high", "medium", "low"]]);

trace(options.join());

tg
04-12-2002, 09:11 PM
you did it right, i read you wrong and thus gave you the incorrect response.