At the moment I'm working in Director MX. I want to retrieve information from a XML file into the Director stage. A text member should load the information from the XML file. I'm like this far:
The XML file:
I've tried to keep the XML file as easy as possible. The XML file is located in the same folder as the Director file. The content of the XML file (author.xml):
The Director File:
The cast of the Director file (author.dir) contains 3 members:
1) A text member (name: author):
This member does not contain any code and it is located at frame 1 of the score.
2) A script member (behavior, name: xmlLoad):
This script is not located in the score, just in the cast. The member contains the following code:
3) A script member (parent, xmlParse):
This script is not located in the score, just in the cast. The member contains the following code:
What exactly is the problem?
I just want a text member to display the name "Mike Peterson" on the stage. Director should load the name from the XML file, but he doesn't. Director does not display any errors. Does anybody know how to fix this problem?
The XML file:
I've tried to keep the XML file as easy as possible. The XML file is located in the same folder as the Director file. The content of the XML file (author.xml):
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<author>
<name>Mike Peterson</name>
</author>
The Director File:
The cast of the Director file (author.dir) contains 3 members:
1) A text member (name: author):
This member does not contain any code and it is located at frame 1 of the score.
2) A script member (behavior, name: xmlLoad):
This script is not located in the score, just in the cast. The member contains the following code:
Code:
property pXMLObj
global gNameAuthor
on beginSprite me
pXMLObj = new (xtra "XMLParser")
pXMLObj.parseURL (the moviePath & "author.xml")
end
on endSprite me
pXMLObj = 0
end
on exitFrame me
if pXMLObj.doneParsing () then
gNameAuthor = pXMLObj.makeList ()
else
go the frame
end if
end
3) A script member (parent, xmlParse):
This script is not located in the score, just in the cast. The member contains the following code:
Code:
global gNameAuthor
on me
member("author").text = gNameAuthor
end
What exactly is the problem?
I just want a text member to display the name "Mike Peterson" on the stage. Director should load the name from the XML file, but he doesn't. Director does not display any errors. Does anybody know how to fix this problem?