PDA

View Full Version : XML problems



Neo-Geo
August 19th, 2003, 02:57 AM
Can anyone help me with this
I got this from flashkit.com-password protection.
It was created in Flash 5. but when i opened it in MX, flash display an output :



Scene=Scene 1, Layer=Layer 1, Frame=1: Line 33: Left side of assignment operator must be variable or property.
eval(people.attributes.TITLE) = people.attributes.NAME;

Scene=Scene 1, Layer=Layer 1, Frame=1: Line 34: Left side of assignment operator must be variable or property.
eval(people.attributes.PASSTITLE) = people.attributes.PASSWORD;

Scene=Scene 1, Layer=Layer 1, Frame=1: Line 36: Left side of assignment operator must be variable or property.
eval(people.attributes.NUM) = people.attributes.VALUE;


i dont know about XML, so i can't figure out whats the problem and whats the output is all about.


// AS in the first frame
// LOADS XML VARIABLES
var varsXML = new XML();
varsXML.onLoad = loadVars;
varsXML.load("test.xml");
// HERE ARE THE FUN LOVING FUNCTIONS!!!
// THIS ONE CHECKS TO SO IF THE USER HAS ENTERED.
// A VALID NAME AND PASSWORD.
function verify() {
goodname = 0;
goodpassword = 0;
for (i=0; i<=accounts.length; i++) {
j = 1;
for (name in accounts[i]) {
if (this['input'+j] == accounts[i][name]) {
this['good'+name] = 1;
}
j++;
}
if (goodname == 1 && goodpassword == 1) {
gotoAndStop(3);
} else {
gotoAndStop(2);
}
}
}
// THIS ONCE PARSES THE XML INTO USABLE VARIABLES.
// THANKS TO VAGABOND FOR PROVIDING THE FRAME WORK FOR THIS ONE.
function loadVars(success) {
if (success) {
var people = varsXML.firstChild.firstChild;
i = 1;
while (people != null) {
eval(people.attributes.TITLE) = people.attributes.NAME;
eval(people.attributes.PASSTITLE) = people.attributes.PASSWORD;
if (people.attributes.NUM eq 'accountnum') {
eval(people.attributes.NUM) = people.attributes.VALUE;
}
people = people.nextSibling;
}
} else {
trace("errorLoadingXML");
}
setObj();
}
// TAKES ALL THE LOADED VARIALBES AND TURNS THEM.
// INTO OBJECTS FOR THE VERIFY FUNCTION.
function setObj() {
accounts = new Array();
for (i=0; i<accountnum; i++) {
accounts[i] = {name:this['name'+i], password:this['password'+i]};
}
}
// THIS ONE STOP'S
stop();

ahmed
August 19th, 2003, 03:30 AM
you can't do this:
eval(people.attributes.NUM) = people.attributes.VALUE;


what are you trying to do exactly?

Neo-Geo
August 19th, 2003, 03:40 AM
this is for password.
when the user type their password, flash confirm it from XML file in the same folder. (This is what it stated in the file that i downloaded)

do you need to look at the fla?

ahmed
August 19th, 2003, 03:46 AM
oh no, i meant, why are you using eval in there?

Neo-Geo
August 19th, 2003, 03:51 AM
I don't have any idea. This is what i download. I don't know about XML nor eval.
It works fine in flash 5 but not when i opened it in MX

Neo-Geo
August 19th, 2003, 04:05 AM
the files