A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: XML to flash as2

Threaded View

  1. #1
    Senior Member
    Join Date
    Jul 2002
    Location
    New Mexico
    Posts
    101

    XML to flash as2

    ok. I have a lot of data to be passed into flash so I decided to use xml parssed from a database using php.
    I got the xml into flash with the following code:

    Code:
    var my_xml = new XML();
    my_xml.ignoreWhite = true;
    my_xml.onLoad = function(success) {
    	if (success) {
    		trace(this);
    	}
    };
    my_xml.load("http://www.800score.com/flashdatatest.php");
    This outputs the following:

    Code:
    <?xml version="1.0"?>
    <entries>
    <entry>
    <date>2010-07-29</date>
    <currentQuestion>1</currentQuestion>
    <yourans>4</yourans>
    </entry>
    <entry>
    <date>2010-07-29</date>
    <currentQuestion>2</currentQuestion>
    <yourans>2</yourans>
    </entry>
    <entry>
    <date>2010-07-29</date>
    <currentQuestion>3</currentQuestion>
    <yourans>3</yourans>
    </entry>
    <entry>
    <date>2010-07-29</date>
    <currentQuestion>4</currentQuestion>
    <yourans>3</yourans>
    </entry>
    <entry>
    <date>2010-07-29</date>
    <currentQuestion>5</currentQuestion>
    <yourans>3</yourans>
    </entry>
    <entry>
    <date>2010-07-29</date>
    <currentQuestion>6</currentQuestion>
    <yourans>3</yourans>
    </entry>
    <entry>
    <date>2010-07-29</date>
    <currentQuestion>7</currentQuestion>
    <yourans>4</yourans>
    </entry>
    <entry>
    <date>2010-07-29</date>
    <currentQuestion>8</currentQuestion>
    <yourans>5</yourans>
    </entry>
    <entry>
    <date>2010-07-29</date>
    <currentQuestion>9</currentQuestion>
    <yourans>2</yourans>
    </entry>
    </entries>
    my question is how do I get from there to arrays of values ie
    currentQuestion array
    yourans array
    date array
    ?
    Keep in mind that the amount of xml data will increase and decrease depending on how many questions the user answers.
    I will be adding more xml data to the real thing...this is only proff of concept trial.
    Thanks in advance
    Last edited by Beyond Flash; 07-30-2010 at 12:29 AM.
    Beyond Flash
    Your one stop web shop
    http://www.beyondflash.net

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