Ask a Question related to Macromedia Director Basics, Design and Development.
-
brightface #1
XML and db and director
Ok heres a biggi
I have a project that requires me to work with xml.
The requirement is to produce a director interface and hook that up to a dbase
Has anyone used a director interface with a database and can I use xml too
Does anyone have any experience with this
Thank
Patric
brightface Guest
-
Director MX to Director MX 2004 FREE Upgrade now available
Director MX to Director MX 2004 - English Macromedia Customers who purchased Director MX between December 6, 2003 and April 9, 2004 (dates subject... -
How to import a director file into director? URGENT
Hi, I've kinda finished what i want to do and i've just realised i kinda stuffed up. i need to "combine" several director files into one. how do i... -
Director MX [for OS X] Get Info says its a Director 8.5 file!?!?!
I am working on a kiosk for the http://www.arsc.edu and when I create files in Director MX and go to the finder to Get Info, it says that its a... -
loading director files into a director file?
Hi I made 2 games in director and I'd like to have something like a menu to choose betweeen the 2 games so i was wondering if there was a way of... -
Can Director MX save a movie as a Director 8.5 file?
Can Director MX save a movie as a Director 8.5 file? I can't find this option in "save as" or "export." HELP! -
Ex Malterra #2
Re: XML and db and director
I've used xml with authorware allot and director a little. i use
director 8.5, dunno if the xml parser is any different in mx or mx
2004.
here is a good refference document:
[url]http://www.macromedia.com/support/director/internet/using_xml_parser_xtra/[/url]
what it boils down to is you have to read in the xml file and store
the data in some way. i make a property list from it. the parser will
make a property list for you, but i find it's easier for me to
understand mine than the one the parser creates. if you make any
changes to the data you have to re-write the xml file to reflect those
changes. here's a code snippet from a task list application i made
that stores task data in an xml file. this is the handler that writes
the updated xml file after data has been manipulated. the global
variable currentXml is the property list that's created when the
application launches and reads in the xml file.
global currentXml
on generateXml
-- write header and main tag
xmlText = "<?xml version=" & quote & "1.0" & quote & "?>" & return &
\
"<taskList lastModified=" & quote & the date & quote & ">" & return
-- write task tags
repeat with counter = 1 to currentXml.count
thisTag = "<task taskNumber=" & quote & counter & quote & "
createdDate=" & quote & currentXml[counter][1][2] & quote & "
dueDate=" & quote & currentXml[counter][1][3] & quote & "
completeDate=" & quote & currentXml[counter][1][4] & quote & ">" &
return & tab & "<taskTitle>" & currentXml[counter][2] & "</taskTitle>"
& return -- title tag
-- comment tags
if (currentXml[counter][3].count <> 0) then
repeat with counter2 = 1 to currentXml[counter][3].count
thisComment = tab & "<statusComment commentNumber=" & quote &
currentXml[counter][3][counter2][1] & quote & " dateCommentAdded=" &
quote & currentXml[counter][3][counter2][2] & quote & ">" &
currentXml[counter][3][counter2][3] & "</statusComment>" & return
thisTag = thisTag & thisComment
end repeat
end if
thisTag = thisTag & "</task>" & return
xmlText = xmlText & thisTag
end repeat
xmlText = xmlText & "</taskList>"
-- write xml file
xmlFileWriter = new(xtra "fileio")
createFile(xmlFileWriter, "taskList.xml")
openFile(xmlFileWriter, "taskList.xml", 0)
-- clear file
writeString(xmlFileWriter, "")
repeat while (error(xmlFileWriter, status(xmlFileWriter)) <> "OK")
nothing
end repeat
-- write new data
writeString(xmlFileWriter, xmlText)
repeat while (error(xmlFileWriter, status(xmlFileWriter)) <> "OK")
nothing
end repeat
xmlFileWriter = 0
return 1
end generateXml
the xml file it writes will look something like this:
<?xml version="1.0"?>
<taskList lastModified="1/19/2004">
<task taskNumber="1" createdDate="10/17/2003" dueDate="10/22/2003"
completeDate="0">
<taskTitle>This is some task.</taskTitle>
<statusComment commentNumber="1" dateCommentAdded="10/18/2003">This
is a comment about this task.</statusComment>
</task>
<task taskNumber="2" createdDate="10/17/2003" dueDate="11/12/2003"
completeDate="0">
<taskTitle>This is another task.</taskTitle>
<statusComment commentNumber="1" dateCommentAdded="11/09/2003">This
is a comment about task number 2.</statusComment>
</task>
</taskList>
Ex Malterra Guest



Reply With Quote

