0 Replies Latest reply on Feb 9, 2011 5:53 PM by vcastelo

    how to drag & drop list using custom itemrender



         I have a List which is populated using a custom itemRenderer in which I override the set data method, so I can display an image. When I enable the dragEnabled on my List, I get a "TypeError: Error #1009: Cannot access a property or method of a null object reference." for the added components in my itemrender. Here is what my custom itemRender looks like.


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

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



      autoDrawBackground="true" width="160" height="150" contentBackgroundColor="#3D3D3D">




              //override to data which includes path for the image component and label

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

                     super.data = value;

                     var url:String = value.filePath.toString();

                     var imagePath:String =url.slice(url.lastIndexOf("\\")).toLowerCase();

                     var fullPath:String = url + imagePath + ".png";

                     var shoeName:String = imagePath.replace("\\", "");

                     shoeName = shoeName.replace("_", " ");

                     thumbnail.source = fullPath;

                     shoeLabel.text = shoeName;






      <s:BorderContainer x="0" y="0" width="160" height="150" borderColor="#FFFFFF" borderWeight="1" backgroundColor="#323232">

      <s:Label id="shoeLabel" x="5" y="109" width="150" color="#FFFFFF" verticalAlign="top" textAlign="center"/>

      <mx:Image y="5" width="150" height="100" id="thumbnail" x="5"/>





      Do i need to create a dragSource and all the drag & drop handlers? how do I go about  implementing this? Any help would be appreciated!!