1 Reply Latest reply on Jul 3, 2009 6:27 AM by leybniz

    Instantiation of component in TileList?

    jcrivera07

      When I create a custom component with some public methods and then I set a itemRenderer property of an <mx:TileList to the custom component's name,I'm unable to call the public methods. Does the tilelist not instantiate a component each time it renders an item/object? if it doesn't, is there some way i can call the public methods that I created for that component?

       

       

      Sample code:

      <mx:Script>

           <![CDATA[

                    obj1.myCustomFunction();   //can I call something like this ?

       

           ]]>

      </mx:Script>

       

      <mx:TileList itemRenderer="myCustomComponent" >

       

           <mx:Object id="obj1" />

            <mx:Object id="obj2" />

       

      </mx:TileLis>

        • 1. Re: Instantiation of component in TileList?
          leybniz Level 4

          Nope you can't do that way,

          since your object is Data item itself and itemRenderer is a visual component whose responsibility is to display Data item.

           

          Generally, you have to put all your logic inside your custom "myCustomComponent" class by overriding data property:

           

          override public function set data(value:*):void {

               super.data = value;

            

               // Here you have your obj1, obj2, objN as value

          }