5 Replies Latest reply on Jan 14, 2009 3:49 PM by rtalton

    itemRenderer in component

    Kyle Laughlin
      From FlexExamples March 8, I am trying to use the TileList and custom itemRenderer. The only change I have made to the code is change the "main" app too a component, as part of a View Stack. I have imported the original code into my application and have the same error: 1172: Definition CustomItemRenderer could not be found.
      It is in the same location as the calling data, but does not seem to work. This is the code from car.mxml and the following is the view stack call from the main app.
        • 1. Re: itemRenderer in component
          ntsiii Level 3
          Did you declare the default local namespace in the component root tag?

          xmlns="*"

          Tracy
          • 2. itemRenderer in component
            Kyle Laughlin Level 1
            Thanks for the response. I have not declared the namespace, but since they are in the same location, do I need to? I have tried several variations of declaring the namespace, but am not getting a change in the error. Some examples of what I have tried:
            xmlns:CustomItemRenderer="*"
            xmlns="views.*"
            xmlns="*"
            xmlns:views="CustomItemRenderer"
            xmlns="CustomItemRenderer"
            xmlns="views.CustomItemRenderer"
            xmlns="views.CustomItemRenderer.mxml"
            xmlns:views="*"
            xmlns.views="*.CustomItemRenderer"
            xmlns:views="*.CustomItemRenderer"
            The main app is called index.mxml and supporting components are in the folder "views". In the index, I have declared a namespace for views xmlns:v="views.*", hence my using "v". It seems I am missing a very large and blatant point? Oh guru flex gods! take pity on newbies and may all your future projects be bug free, fun and profitable!
            • 3. Re: itemRenderer in component
              Kosmikko
              Use the whole package name. E.g itemRenderer="com.package.views.CustomItemRenderer"
              • 4. Re: itemRenderer in component
                Yozef0 Level 1
                Hah! Kosmikko, you nailed it right.

                So adding the full path to the class in the itemRenderer solved my problem.
                Thanks :)
                • 5. Re: itemRenderer in component
                  rtalton Level 4
                  In the component root tag, add something like this:
                  xmlns:myRenderer="views.CustomItemRenderer"
                  (if your custom component is in a folder named "views")
                  Notice that "myRenderer" can be whatever name you want; I chose a name different from your examples to avoid confusion with the folder named "views".
                  This does the same thing as Kosmikko's answer.