Trying to use a list and ItemRenderer to display output of a
HTTPService called XML file. The issue is that the XML can have
between 1 - 3 'Date' nodes and 1 - 3 'Location' nodes per 'Show'. I
think some sort of repeater / loop is required but my attempts thus
far have not gone well.
The source included does display all the data to the screen, just in a
fugly manner. If someone can offer tips on the itemRepeater process
for lists, most of what I've seen is pointed for dataGrids and I've
been unable to repurpose.
--------------------------------------
XML Source:
--------------------------------------
<Shows>
<Show Title="Name here">
<Date Time="January 30, 2006 - 10am to 5pm"/>
<Date Time="January 31, 2006 - 11am to 3pm"/>
<Location Place="Building"/>
<Location Place="City, Prov"/>
</Show>
</Shows>
--------------------------------------
onResult function:
--------------------------------------
public function onResult(event:*=null):void {
var ShowsXML:XML = new XML(event.result);
trace (ShowsXML);
for each (var Show:XML in ShowsXML.Show) {
var newShow:ShowVO = new ShowVO();
newShow.Title = [EMAIL PROTECTED];
for each (var ShowDates:XML in Show.Date) {
newShow.Dates.addItem([EMAIL PROTECTED]);
}
for each (var ShowLocations:XML in Show.Location) {
newShow.Locations.addItem([EMAIL PROTECTED])
}
ModelLocator.getInstance().Shows.addItem(newShow);
}
}
--------------------------------------
ShowVO Package:
--------------------------------------
import mx.collections.ArrayCollection;
[Bindable]
public class ShowVO {
public var Title:String = new String();
public var Dates:ArrayCollection = new ArrayCollection();
public var Locations:ArrayCollection = new ArrayCollection();
}
--------------------------------------
Main .mxml:
--------------------------------------
<mx:VBox label="Shows & Tours" width="100%" height="100%">
<mx:Text width="100%" text="You can find us here:" textAlign="center"
color="#ffffff"/>
<mx:List id="myList" rowHeight="75" width="100%" height="100%"
itemRenderer="renderers.ShowTour"
dataProvider="{ModelLocator.getInstance().Shows}"/>
</mx:VBox>
--------------------------------------
renderers.ShowTour:
--------------------------------------
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
horizontalAlign="center">
<mx:Label text="{data.Title}" textAlign="center" fontStyle="bold"/>
<mx:Label text="{data.Dates}" textAlign="center"
fontStyle="italic"/> <mx:Label text="{data.Locations}"
textAlign="center"/>
</mx:VBox>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/