-
Actionscript not loading XML into Dynamic Fields
I am working on a project where I am reading (trying to!) from an xml file. I have 5 separate dynamic text fields that I am filling with the individual digits from a string. I am not an expert but really think my code should work. Below is the actionscript and the xml I am using.
import fl.controls.*;
var digit01_xml:XML;
var xmlReq:URLRequest = new URLRequest("testRBS.xml");
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.load(xmlReq);
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
function xmlLoaded(event:Event):void
{
digit01_xml = new XML(xmlLoader.data);
var mystring:String = digit01_xml.RicohRewards[0].tokens[0];
d01_txt.text = mystring.charAt(1);
d02_txt.text = mystring.charAt(2);
d03_txt.text = mystring.charAt(3);
d04_txt.text = mystring.charAt(4);
d05_txt.text = mystring.charAt(5);
}
<?xml version="1.0" encoding="utf-8"?>
<RicohRewards>
<show>1</show><!--boolean 0 or 1, show gauge flash or not-->
<percentage>25</percentage><!--value between 0 to 100-->
<tokens>0102347</tokens><!--total tokens earned-->
</RicohRewards>
Any help would be much appreciated!
-
Senior Member
If you are looking for AS3 help.. maybe posting in the AS3 forum would yield better results..
Tags for this Thread
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
|