3 Replies Latest reply on Jan 16, 2012 2:24 PM by Claudiu Ursica

    Retrieve a child in a ItemRenderer

    ChoupiChoupa

      Hello everybody,

       

      I have a problem, let me explain :

       

      I have an ItemRenderer named "myItem" in MXML with an image :

      Code :

      <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" >

           <s:Image width="30" height="30" horizontalCenter="0" source="d:/test1.jpg" verticalCenter="0" />

      </s:ItemRenderer>

      To retreive my image in a actionscript file,  i do this :
      Code :

      var elem:myItem = event.target as myItem;

      var img:Image = elem.getChildAt(0) as Image;

       

      Now, i want to add a border to my image :

       

      Code :

      <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" >

           <s:BorderContainer borderWeight="1"  backgroundColor="#cccccc" height="40" width="50">

                <s:Image width="30" height="30" horizontalCenter="0" source="d:/test1.jpg" verticalCenter="0" />

           </s:BorderContainer>

      </s:ItemRenderer>

       

       

      How can i get my image ? ...

       

      Thx

      __________________