Gentlemen,
The following is the custom Item Renderer for the TileList control. The
function initImageBkColor() gets fired when the itemRenderer gets its
data from the TileList DataProvider.
-------------- Custom Item Renderer -------------
<?xml version="1.0" encoding="iso-8859-1"?><?xml version="1.0"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
horizontalAlign="center"
verticalGap="0"
horizontalGap="0"
borderStyle=".5"
width="100"
height="150"
click="thumbClicked()"
horizontalScrollPolicy="off"
verticalScrollPolicy="off"
>
<mx:Script>
<![CDATA[
import mx.core.IFlexDisplayObject;
import mx.controls.Alert;
import flash.events.Event;
import com.adobe.cairngorm.control.CairngormEventDispatcher;
// initImageBkColor() fires from thumbLabel
{initImageBkColor(data.isPublished)}
// the trick is to return a null string so that the isPublished
variable is not
// displayed in the thumbLabel's text. I am doing this inorder
to fire the function when data is loaded into this renderer.
private function initImageBkColor(tempData:Object):String {
trace("Thumbinit= " + tempData.templateId + "
isPublished= " + tempData.isPublished);
var returnVar:String ='';
if (Number(tempData.isPublished) == 1){
trace("insideColor= " + tempData.templateId );
this.setStyle("borderColor", "0xff6600");
this.setStyle("borderThickness", "2");
//box.setStyle("backgroundColor", "0xff6600");
returnVar = "Currently Published";
}
else{
trace("insideColor= " + tempData.templateId );
this.clearStyle("borderColor");
}
return returnVar;
}
]]>
</mx:Script>
<mx:Zoom id="zoomIn" zoomHeightTo="1.2" zoomWidthTo="1.2"/>
<mx:Zoom id="zoomOut" zoomHeightTo="1" zoomWidthTo="1"/>
<mx:VBox id="box" horizontalAlign="center" paddingLeft="5"
paddingRight="5" paddingBottom="5">
<mx:Label id="thumbLabel" color="black" text="{data.name}"
textAlign="center" fontWeight="bold"/>
<mx:Image
id="image" x="{image.width/2}" y="{image.height/2}"
horizontalAlign="center"
source="{data.vImagePath}"
scaleX="1" scaleY="1"
rollOverEffect="zoomIn"
rollOutEffect="zoomOut"
/>
<mx:Label id="thumbLabel1" color="#ff6600"
text="{initImageBkColor(data)}" textAlign="center" fontWeight="bold"/>
</mx:VBox>
</mx:VBox>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/