customizing item renderer
Posted
by
BretzelPretzel
on Stack Overflow
See other posts from Stack Overflow
or by BretzelPretzel
Published on 2011-11-15T01:45:34Z
Indexed on
2011/11/15
1:51 UTC
Read the original article
Hit count: 140
flex
|itemrenderer
i would like the label and message to be on the left of the icon....i would also like the icon to be right-aligned
what is the best way to do this? I'm confused by some of the tutorials i'm seeing for custom item renderers since they never explain how to format the renderer mxml, so i haven't figured that out yet although i suspect that's what i need to be doing
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:components="components.*"
creationComplete="imagelistings.send()" title="{data.title}">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.events.FlexEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import spark.events.IndexChangeEvent;
import valueObjects.imagelistingclass;
[Bindable] private var listings:ArrayCollection = new ArrayCollection();
protected function toursService_resultHandler(event:ResultEvent):void
{
var listingarray:ArrayCollection=event.result.Chapter1.entry;
var entry:imagelistingclass;
for each(var plate:Object in listingarray)
{
entry=new imagelistingclass();
entry.image=plate.image;
entry.location=plate.location;
entry.html=plate.html;
listings.addItem(entry);
}
}
]]>
</fx:Script>
<fx:Declarations>
<s:HTTPService id="imagelistings" result="toursService_resultHandler(event)"
url="assets/chapter1info.xml"/>
</fx:Declarations>
<s:List id="theList" left="0" right="0" top="0" bottom="0" alternatingItemColors="#000000"
contentBackgroundColor="#404040" dataProvider="{listings}" horizontalScrollPolicy="off" >
<s:itemRenderer>
<fx:Component>
<s:IconItemRenderer color="#FFFFFF" fontSize="30" iconField="location" labelField=""
iconFillMode="scale" iconScaleMode="letterbox" iconHeight="125"
messageField="image">
</s:IconItemRenderer>
</fx:Component>
</s:itemRenderer>
</s:List>
© Stack Overflow or respective owner