parseURL()
441
The movie script contains the
on parseDone
handler:
on parseDone
global gParserObject
if voidP(gParserObject.getError()) then
put "Successful parse"
else
put "Parse error:"
put " " & gParserObject.getError()
end if
end
This JavaScript syntax parses the file sample.xml and calls the
parseDone
function. Because no
script object is given with the
doneParsing()
function, the
parseDone
function is assumed to be
in a movie script.
errorCode = _global.gParserObject.parseURL("http://- www.MyCompany.com/
sample.xml", symbol("parseDone"));
Note:
This example supposes that an instance of the Xtra has already been created, and a reference
to that has been stored in the global variable named gParserObject.
The movie script contains the
on parseDone
handler:
// JavaScript syntax
function parseDone () {
if (_global.gParserObject.getError() == undefined) {
trace("successful parse");
} else {
trace("Parse error:");
trace(" " + _global.gParserObject.getError());
}
}
This Lingo parses the document sample.xml at MyCompany.com and calls the
on parseDone
handler in the script object
testObject
, which is a child of the parent script TestScript:
parserObject = new(xtra "XMLParser")
testObject = new(script "TestScript", parserObject)
errorCode = gParserObject.parseURL("http://www.MyCompany.com/sample.xml",
#parseDone, testObject)
Here is the parent script TestScript:
property myParserObject
on new me, parserObject
myParserObject = parserObject
end
on parseDone me
if voidP(myParserObject.getError()) then
put "Successful parse"
else
put "Parse error:"
put " " & myParserObject.getError()
end if
end
Summary of Contents for DIRECTOR MX 2004-DIRECTOR SCRIPTING
Page 1: ...DIRECTOR MX 2004 Director Scripting Reference...
Page 48: ...48 Chapter 2 Director Scripting Essentials...
Page 100: ...100 Chapter 4 Debugging Scripts in Director...
Page 118: ...118 Chapter 5 Director Core Objects...
Page 594: ...594 Chapter 12 Methods...
Page 684: ...684 Chapter 14 Properties See also DVD...
Page 702: ...702 Chapter 14 Properties See also face vertices vertices flat...
Page 856: ...856 Chapter 14 Properties JavaScript syntax sprite 15 member member 3 4...
Page 1102: ...1102 Chapter 14 Properties...