2 Replies Latest reply on Mar 8, 2012 1:11 PM by mikertjones

    Trouble with itemRenderer


      Hello all


      Just getting started with Flex using FlashDevelop.


      I have been copying and pasting sample code as well as writing my own snippets - the learning curve is steep but I'm loving it!


      I'm really stuck on the idea of a separate mxml file holding a itemRederer for a Spark List control (or should that be a container?)


      Here's my Main.mxml


      <?xml version="1.0" encoding="utf-8"?>

      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"



          preinitialize="preinitHandler(event)"  >



              import mx.collections.ArrayList;

              import mx.events.FlexEvent;



              private var monthsList:ArrayList;


              protected function preinitHandler(event:FlexEvent):void {

                  monthsList = new ArrayList(["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November","December"]);





          <s:List id="months"  horizontalCenter="0" y="50"  dataProvider="{monthsList}" itemRenderer="renderer" />




      Here's the renderer.mxml file


      ?xml version="1.0" encoding="utf-8"?>

      <s:itemRenderer name="renderer"


      xmlns:s="library://ns.adobe.com/flex/spark" >



                  <s:Label text="{data}" paddingTop="3" paddingBottom="3" fontSize="18" />





      On running Test Project I get the folowing Warning error:

      Could not resolve <s:itemRenderer> to a component implementation


      I have searched for several hours and tried differnt things but it is obviously a failing in my understanding.


      Can anybody help me out please?


      I like to get examples that work and then extend them a little - tetsing what I know. It's frsutrating when they break!


      Thanks in advance


      Mike Jones