Variables and arrays

I’ve written the following script (print from the movie explorer) but I can’t see the inputed variables in the trace screen. What do I do wrong?

greetings,
Han

Scene 1
actions for frame 1
alleWerkgevers = new Array();
nummer = 1;
function voegToe(bedrijfsnaam, functie, startDatum, eindDatum, plaats, werkzaamheden){
_root[“werkgever”+nummer] = new Array ();
_root[“werkgever”+nummer].push(bedrijfsnaam, functie, startDatum, eindDatum, plaats, werkzaamheden);
alleWerkgevers.push(_root[“werkgever”+nummer]);
trace ("werkgever "+nummer + _root[“werkgever”+nummer]);
trace ("Alle werkgevers " + alleWerkgevers);
nummer++;
}
function verwijder (){
alleWerkgevers.pop();
nummer–;
trace ("Alle werkgevers "+alleWerkgevers);
}

(empty), (bedrijfsnaam)
(empty), (functie)
(empty), (startDatum)
(empty), (eindDatum)
(empty), (plaats)
(empty), (werkzaamheden)

voegtoeBT, <voegtoeBT>
actions for voegtoeBT
on (release){
_root.voegToe(bedrijfsnaam, functie, startDatum, eindDatum, plaats, werkzaamheden);
}

verwijderBT, <verwijderBT>
actions for verwijderBT
on (release){
_root.verwijder();
}

Symbol Definition(s)
voegtoeBT
Voeg toe, (Arial, 28 pts)

verwijderBT
Verwijder, (Arial, 28 pts)

!!! JUST GOT BACK INTO FLASH AND I DON’T REMEMBER IF THIS IS CORRECT, SO DON’T KUNG FU MY *** IF I’M WRONG !!!

I think your problem is here:

_root[“werkgever”+nummer] = new Array ();

-Im not sure if you can use _root as an array name, you should try something like this:

arrayName = new Array();

and i don’t think you can have anything other than an number when you call out a part of the array:

someVariable = arrayName[0]

instead of:

someVariable = arrayName[someWord]

*Originally posted by nemoBejingler *
**I think your problem is here:

_root[“werkgever”+nummer] = new Array ();

**
if werkgever is a string try

eval(“_root.werkgever”+nummer) = new Array()

if werkgever is a variabe try

eval(_root.werkgever+nummer) = new Array()

*Originally posted by nemoBejingler *
**and i don’t think you can have anything other than an number when you call out a part of the array:

someVariable = arrayName[0]

instead of:

someVariable = arrayName[someWord]**

Since you have a numerically indexed array - constructed using push() then you can only use numerical indices. If you want to create an associative array then you would construct it using the syntax

lunchbox=new Array()
lunchbox[“sandwich”]=“ham and cheese”
lunchbox[“drink”]=“milk”

if you trace lunchbox[“sandwich”], it will return “ham and cheese”

If you want to create a multi-dimensional array then use the syntax

lunchbox=new Array()
lunchbox[“sandwich”]=[“bread”, “ham”, “cheese”]

if you trace lunchbox[“sandwich”][1] it will return “ham”

Thank you for the aswers. I found the problem. It is a silly problem. I explain: I used a MC as a button. In that case you have to write _root. in front of each variable in the on(release)-function in the MC.
When you change the MC into an BT then it works without that _root.
Very silly!

greetings,
Han