PDA

View Full Version : Thumbnail Gallery - better way to get this data?


Mortimer Jazz
10-26-2006, 08:20 AM
Hi, I am loading some XML in to Flex.

My XML looks like this:

<images>
<gallery name="Screenshots">
<imageNode picURL="img9.jpg">Description</imageNode>
</gallery>
<gallery name="Other">
<imageNode picURL="img1.jpg">Description</imageNode>
</gallery>
</images>


My HTTPService component doesn't specify a "resultFormat", and so my XML data should automatically be converted to ObjectProxies (with any arrays being wrapped in an ArrayCollection ...and this happens - cool).
(note: I want to learn how to deal with data this way - i already know how to do it using E4X)

I display the arrayCollection of imageNodes like so:
imgData = e.result.images.gallery.getItemAt(0).imageNode; //works

...but I also want to display a list of the gallery names in a combo box.:

I was hoping to be able to do something like this:
//as code:
comboData = e.result.images.gallery;

//mxml
<mx:ComboBox labelField="name" />
------------------------------------------------
That doesn't work 100% when making an asynchronous call to XML, because the runtime debugger fails on 'name' not being declared (although it still populates the combo correctly!)

If i try to declare 'name' at the top of the class I get a naming conflict (bah - bad choice of labels!) How can I fool the compiler here?

Can anybody set me on the right track?