5/25/2010 12:46:13 AM
Title:
how to repeat the images in a horizontal list
hi all,
i have a horizontal list in which images are displayed from a xml file .say there are 5 images ,after completion of 5th image the 1st image and so on should display.
in simple i want the horizontal list to scroll the images in a clockwise direction and anti-clockwise direction based on mouse movement.
thanks in advance,if u have sample code ,i will be greatfull to u
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="imgService.send()"
xmlns:v="components.*" >
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
/* public var imgdata:Object = parent.document.MyComp; */
private function imgresultHandler(event:ResultEvent):void{
var imgdata:Object=event.result as XML;
}
private function imghandleFault(event:FaultEvent):void{
trace(event.fault.faultCode+":"+event.fault.faultString);
}
]]>
</mx:Script>
<mx:HTTPService id="imgService" url="imagescrolldata.xml" resultFormat="e4x" result="imgresultHandler(event)"
fault="imghandleFault(event)" />
<mx:XMLListCollection id="imgList" source="{imgService.lastResult.spotdetails}"/>
<mx:HorizontalList id="imghlist" columnWidth="125" rowHeight="125" columnCount="3"
dataProvider="{imgList}" itemRenderer="components.ImageAndDesc"/>
</mx:Application>
-------------------------------------------component code
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
[Bindable]
//private var myarray:Array = new Array(); wanted to pass the array of images
private function scrollimage():void{
if(img.x<500){
img.x+=5;
}else{
img.x=0;
}
}
]]>
</mx:Script>
<mx:Image id="img" source="{data.@mediahubthumbnail}" mouseMove="scrollimage()"/>
</mx:VBox>
5/25/2010 1:15:18 AM
check this link:
http://joelhooks.com/2009/12/24/continuous-scrolling-thumbnail-component-for-flex/