-
This is the third web app I've built that intergrates Flash and XML, but for some reason I am having problems. I made a simple test app to see if I am getting data and it doesn't work. Here is what I did.
Created xml file: "student.xml"
<?xml version="1.0"?><ESIML><student name="Alex Banks">Hello, I am a student</student></ESIML>
I ran the tags together because this is the only way I could get it to work in the past. The sturcture is really like this:
<?xml version="1.0"?>
<ESIML>
<student name="Alex Banks">Hello, I am a student</student>
</ESIML>
I then created a one frame test movie called student. In the first frame I typed the following ActionScript:
studentFile = new XML();
studentFile.load("student.xml");
function setVars () {
var1 = studentFile.firstChild;
var2 = studentFile.firstChild.firstChild;
var3 = studentFile.firstChild.firstChild.firstChild;
var4 = studentFile.firstChild.firstChild.attributes.name. VALUE;
var5 = studentFile.firstChild.nodeName;
var6 = studentFile;
trace("var1: " + var1);
trace("var2: " + var2);
trace("var3: " + var3);
trace("var4: " + var4);
trace("var5: " + var5);
trace("var6: " + var6);
}
studentFile.onLoad = setVars();
stop();
When I test the movie this is the output that I get:
var1: null
var2:
var3:
var4:
var5:
var6:
What could I possibly be doing wrong. I fought with this stuff for 3 hours yesterday, and like I said I've done this before. Any weird flash rules. Something I am missing. why does it say that the xml is null? Why can't I get vars. Help please.
Alex
-
Sorry, Here is the real XML. I replaced < with [ and > with ] so that we can see the code in the browser window.
Created xml file: "student.xml"
[?xml version="1.0"?][ESIML][student name="Alex Banks"]Hello, I am a student[/student][/ESIML]
I ran the tags together because this is the only way I could get it to work in the past. The sturcture is really like this:
[?xml version="1.0"?]
[ESIML]
[student name="Alex Banks"]Hello, I am a student[/student]
[/ESIML]
Thanks,
Alex
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|