Im trying to update a flash movie quiz that records names and question answers which i didnt write. The quiz works except it replaces the name with null. All the other records work fine. I have deleted out the res2 - res12 just to shorten it up, they all work well. Thanks in advance for any light you can shed on this

From Name input page of the quiz. participname is the text field input

Semicolons can really save the compiler a lot of trouble figuring out where a statement ends. While it won't give you an error it can confuse the compiler. Try adding in semicolons at the end of every statement and see if your issue helps.

What mocca said is useful also, to not use reserved property names are vars such as the var 'name'. However you did use 'Name' with a capital N so this does not conflict. You also used 'loader' and there is a display class called 'Loader' with a capital L so again you slipped by a small margin. This isn't a good practice. Make it 'myLoader' or 'dataLoader' or anything but a built in class or property name. It can easily be mistaken or omitted and you can get yourself into trouble. Be careful on the reserved word usage.

It's a difference of "scope". If you go in a timeline script and init the var outside of a function it will be a "global" var, available for shared use inside functions, like this:

var myname:String = "Bob";

function myFuncA():void

{

trace("I can use myname: " + myname); // traces Bob

}

function myFuncB():void

{

trace("I can use it too: " + myname); // traces Bob

}

myFuncA();

myFuncB();

However, if you make the variable inside a function, it will only exist inside that function. By 'make', I mean use the keyword 'var'. Consider this example where I try to change the var myname:

var myname:String = "Bob";

function myFuncA():void

{

// use 'var' and set myname

var myname:String = "Sam";

trace("I can use myname: " + myname); // traces Sam

}

function myFuncB():void

{

trace("I can use it too: " + myname); // traces Bob, not Sam

}

myFuncA();

myFuncB();

Notice the second function when used will trace "Bob" even though myFuncA traced "Sam". The reason why is when I used the keyword 'var' inside the function myFuncA I made a brand new variable 'scoped' to the function myFuncA. Once that function ends, the variable is destroyed.

Now consider this, where I don't use var:

var myname:String = "Bob";

function myFuncA():void

{

// not using 'var' so I'm accessing the global var itself

myname = "Sam";

trace("I can use myname: " + myname); // traces Sam

}

function myFuncB():void

{

trace("I can use it too: " + myname); // traces Sam

}

myFuncA();

myFuncB();

Because I didn't re-init the var and used a variable that's global scope directly inside the function, I changed the global value successfully. Now both functions will trace "Sam".