Your iTunes playlist with Flex

November 25, 2007

Follow up to a tutorial I wrote a long time ago, here's how to display the XML file with Flex. Mike, no need for AS3 ;-)

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical" verticalAlign="top" backgroundColor="white"
creationComplete="itunesXML.send();">

<mx:HTTPService id="itunesXML" url="iTunes.xml" resultFormat="e4x" />
<mx:XMLListCollection id="songs" source="{itunesXML.lastResult.song}" />

<mx:DataGrid id="dataGrid" dataProvider="{songs}" width="100%">
 <mx:columns>
  <mx:DataGridColumn id="artist" dataField="Artist" headerText="Artist" />
  <mx:DataGridColumn id="album" dataField="Album" headerText="Album" />
  <mx:DataGridColumn id="bandname" dataField="Name" headerText="Name:" />
 </mx:columns>
</mx:DataGrid>
</mx:Application>

See the Itunes playlist with Flex SWF example or take a look at the source file here.

Older posts...

You can also browse the archives or go home

About

Hi, I’m Tim. I’m a Software Engineer at Formspring.me. You can read more about me or follow @pims on Twitter or ask me almost anything on Formspring.me