So, i had to look for some other nice component. And i found the DisplayShelf component. It went MUCH more smoothly. I don't pretend to have it done the best way (especially when i had to move into an Array the photos data read from the XML into an ArrayCollection), but it worked well. And the result of the first version can be seen here.
And if anyone is interested in the actual code i came to, here it is:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application backgroundAlpha="0" backgroundColor="#fdfbfc" initialize="init();" creationComplete="imgData.send();" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:local="*" height="100%" width="100%" layout="vertical">
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.core.IUIComponent;
[Bindable]
private var imgsXML:String;
[Bindable]
private var imgs:ArrayCollection;
[Bindable]
private var dataSet:Array;
private var imgsNumb:Number;
private function init():void
{
imgsXML = Application.application.parameters.loc + '?' + Math.random()
}
private function imgDataHandler(event:ResultEvent):void
{
imgs=event.result.images.image;
dataSet = new Array();
imgsNumb = event.result.images.image.length;
for(var i:uint; i < imgsNumb; i++)
{
dataSet[i] = imgs[i].src;
}
}
]]>
</mx:Script>
<mx:HTTPService id="imgData" url="{imgsXML}" result="imgDataHandler(event)"/>
<local:DisplayShelf id="shelf" horizontalCenter="0" verticalCenter="0"
borderThickness="10" borderColor="#FFFFFF" dataProvider="{dataSet}" enableHistory="false" width="100%"/>
</mx:Application>
how to run display shelf with XML loading. pls help in this concern
Ramesh
not sure what exactly you need, but in the provided example i did use xml to load data. As you can see there i created the function imgDataHandler that creates the dataSet for the DisplayShelf.
Thanks Ramesh and Good Luck
Alan T
file name i used is images.xml and the structure is:
<?xml version="1.0" encoding="utf-8"?> <images> <image> <src>media/photos/chisinau2007/IMG_0320.jpg</src> </image> <image> <src>media/photos/chisinau2007/IMG_0325.jpg</src> </image> </images>