PDA

View Full Version : simple array syntax question


boze
10-04-2004, 03:25 AM
what's the difference between:
menu1_sub = [{label:"Bios"}, {label:"Press Clippings"}, {label:"Magazine Covers"}]; and a normal array of strings? does this create a new obj called "label" on the fly or something or are they just var names and values?

can somebody give me a tiny snippet of how you'd use something like this?

i'm still smurfing around with my AS menu and every little shortcut helps....

Xeef
10-04-2004, 09:49 AM
hi

menu1 = [{Type:"Left", Sice:7, BlaBla:"Bla"}, {Type:"Rigth", Sice:11, BlaBla:"Hallo"}];
trace(menu1);
trace(menu1[0]);
trace(menu1[0].Type);
//The LONG way
menu2 = new Array();
Obj = new Object();
Obj.Type = "Left";
Obj.Sice = 7;
Obj.BlaBla = "Bla";
menu2[0] = Obj;
trace(menu2);
trace(menu2[0]);
trace(menu2[0].Type);
trace(menu2[0].BlaBla);