<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:c="*" width="300" viewSourceURL="srcview/index.html"> <fx:Script> <![CDATA[ /** * Return a different item renderer based on if its a heading or not */ public function myRendererFunction(item:*):IFactory { if (item.isHeading) return new ClassFactory(HeadingItemRenderer); else return new ClassFactory(DetailItemRenderer); } ]]> </fx:Script> <s:Label text="Flex 4 CheckList" fontSize="16" fontWeight="bold" horizontalCenter="0" y="10" /> <c:CheckList itemRendererFunction="myRendererFunction" width="300" height="300" y="30"> <c:layout> <s:VerticalLayout gap="1" horizontalAlign="contentJustify" /> </c:layout> <c:dataProvider> <s:ArrayList> <c:Task text="Monday" isHeading="true" /> <c:Task text="Learn about Group and DataGroup" /> <c:Task text="Write a custom layout" /> <c:Task text="Learn how to write custom skins in spark" /> <c:Task text="Tuesday" isHeading="true" /> <c:Task text="Experiment with the new effects" /> <c:Task text="Write custom item renderers" /> <c:Task text="Have fun with data binding" /> <c:Task text="Wednesday" isHeading="true" /> <c:Task text="Build custom components" /> <c:Task text="Try out the new states syntax" /> <c:Task text="Thursday" isHeading="true" /> <c:Task text="Connect to a ColdFusion backend" /> <c:Task text="Connect to a PHP backend" /> <c:Task text="Check out the new features in Flash Builder" /> <c:Task text="Next Week" isHeading="true" /> <c:Task text="Play around with Flash Catalyst" /> <c:Task text="Start blogging about Flex 4" /> </s:ArrayList> </c:dataProvider> </c:CheckList> </s:Application>