开发者

Help with creating a custom ItemRenderer for Flex 4

开发者 https://www.devze.com 2022-12-31 19:59 出处:网络
I\'m trying to create a custom ItemRenderer for a TileList in Flex 4. Here\'s my renderer: <?xml version=\"1.0\" encoding=\"utf-8\"?>

I'm trying to create a custom ItemRenderer for a TileList in Flex 4.

Here's my renderer:

<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" 
                xmlns:s="library://ns.adobe.com/flex/spark" 
                xmlns:mx="library://ns.adobe.com/flex/mx" 
                autoDrawBackground="true">

    <mx:Image x="0" y="0" source="../images/blank-offer.png" width="160" height="144" smoothBitmapContent="true"/>
    <s:Label x="5" y="20" text="{data.title}" fontFamily="Verdana" fontSize="16" color="#696565" width="155"/>
    <s:Label x="5" y="42" text="{data.description}" fontFamily="Verdana" fontSize="8" color开发者_运维技巧="#696565" width="154"/>
    <mx:Text x="3" y="59" text="{data.details}" fontFamily="Verdana" fontSize="8" color="#696565" width="157" height="65"/>
    <mx:Text x="3" y="122" text="{data.disclaimer}" fontFamily="Verdana" fontSize="5" color="#696565" width="157" height="21"/>

</s:ItemRenderer>

Here's my tile list:

<mx:TileList x="0" y="0" width="100%" height="100%" id="tileList" creationComplete="tileList_creationCompleteHandler(event)" dataProvider="{getDataResult.lastResult}" labelField="title" itemRenderer="renderers.OfferLibraryListRenderer"></mx:TileList>

When I run the app, I get this error:

Error #1034: Type Coercion failed: cannot convert renderers::OfferLibraryListRenderer@32fce0a1 to mx.controls.listClasses.IListItemRenderer.


I think in Flex4 you should use the <s:List> component instead of the <mx:TileList>. I've tried this way and it works.

0

精彩评论

暂无评论...
验证码 换一张
取 消