External XML and AS3
- by VideoDnd
I want to pass external XML a variable. How do I do this?
WHAT I'M AFTER
- update my variable with COUNT XML
WHAT I'M NOT GETTING
- The integer to String values
- How to pass XML to a variable
link http://videodnd.weebly.com/
time.xml
<?xml version="1.0" encoding="utf-8"?>
<SESSION>
<COUNT TITLE="starting position">-77777</COUNT>
</SESSION>
xml.fla
//VARIABLES
/*CHANGE TO COUNT
MyString or count, I don't know if it was necessary to go from int to String
*/
var myString:String = "";
var count:int = int(myString);
trace(count);
//LOAD XML
var myXML:XML;
var myLoader:URLLoader = new URLLoader();
myLoader.load(new URLRequest("time.xml"));
myLoader.addEventListener(Event.COMPLETE, processXML);
//PARSE XML
function processXML(e:Event):void {
myXML = new XML(e.target.data);
trace(myXML.COUNT.*);
trace(myXML);
//TEXT
var text:TextField = new TextField();
text.text = myXML.COUNT.*;
addChild(text);
}
output window 'traces to the output window correctly'
//zero should read -77777 if tracing correctly
0
-77777
<SESSION>
<COUNT TITLE="starting position">-77777</COUNT>
</SESSION>
errors
coercion errors and null references with anything I attempt.