View Full Version : passing xml data to a label with XMLList

10-11-2009, 11:47 PM

i read the data from an xml file and trying to pass some elements to a label:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
<mx:HTTPService id="questionsData" url="assets/questions.xml" result="questionsHandler(event)" resultFormat="e4x"/>

import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
import mx.collections.ArrayCollection;
public var questionsStock:XMLList;
public function questionsHandler(evt:ResultEvent):void {
<mx:Label x="210" y="113" text="{questionsStock.text()}" width="216" height="20" id="label1"/>

the xml file is like this:

<?xml version="1.0" encoding="iso-8859-1"?>
<title>An angle of 45 degrees is in radians:</title>
<title>Which angle is of the same terminal side with an angle of 60 degrees:</title>

how can i get the content of one title at a time?? with questionsStock.text() i get the content of all titles.

10-12-2009, 05:23 PM

for each( var o : Object in questionsStock){
//do your stuff

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum