views:

829

answers:

1

I have a TileList that's loaded with data from Flickr. The tilelist uses an imageRenderer to make a bunch of thumbnails.

I'm trying to create a custom drag and drop function, but I want to get the image source of the tilelist mouseEvent target. Here's what the code looks like for the drag handler:

public function onPicMouseDown(e:MouseEvent):void {
            var tileList:TileList = TileList(e.currentTarget);

            var item:Object = Object(tileList.selectedItem);

            var source:DragSource = new DragSource();

            var dragView : Image = new Image();
            dragView.source = tileList.selectedItem.source;

            DragManager.doDrag(
       rowRenderer,
       source,
       e,
       dragView
     );
}

But tileList.selectedItem doesn't have a source property. The source is a property of the image produced by the itemrenderer. I'd like to be able to do something that's the equivalent of

tileList.selectedItem.itemRenderer.source

But that doesn't do it either.

There's got to be a simple way to do this that I'm just missing. Any help would be much appreciated.

A: 

In your onMousePicDown handler your source should be:

dragView.source = event.target.parent.source;
Hibiscus