PDA

View Full Version : doDrag throwing weird error


shizny
05-14-2008, 10:15 PM
I just don't understand what is going on here. I have the following code

var dragChild:UIComponent = UIComponent(event.currentTarget);



var ds:DragSource = new DragSource();


ds.addData(dragChild.parent, 'dragParent');

ds.addData(dragChild, 'dragChild');



var proxy:UIComponent = UIComponent(event.currentTarget);

var bitmapData:BitmapData = new BitmapData(proxy.width, proxy.height);

bitmapData.draw( proxy );

var bitmap:Bitmap = new Bitmap( bitmapData );

var image:Image = new Image();

image.source = bitmap;



// Call the DragManager doDrag() method to start the drag.
DragManager.doDrag(dragChild, ds, event, image);

The problem throws an error on the last line saying
A term is undefined and has no properties

And then opens up the AdvancedDataGrid.as file and shows me this line.

public function get firstVisibleItem():Object
{

--> return listItems[0][0].data;

}

Why am I getting an error thrown, and why is it being thrown in the AdvancedDataGrid.as file. I am not doing anything with the AdvancedDataGrid. Just using Panels, Canvas, Vbox, and UIComponent.

If I comment out all the addData lines there is no error thrown, so it has something to do with what I'm putting in the Datasource. I also checked those variables and they seem ok.

Any ideas?

shizny
05-14-2008, 11:30 PM
I can subsitute what I'm trying to addData with with this

var myBalls:uint = 0x000000;
ds.addData(myBalls, 'color');

and it works fine. ???