A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Actionscript not loading XML into Dynamic Fields

  1. #1
    Getting Into Flash
    Join Date
    Jan 2007

    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.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"?>
    <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-->

    Any help would be much appreciated!

  2. #2
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    CFA2h (respect the HEX)
    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

Click Here to Expand Forum to Full Width

HTML5 Development Center