I think you want to use dataForFormat(“items”).
We describe the drag and drop from the list classes here: http://livedocs.macromedia.com/flex/15/flex_docs_en/00000623.htm.
In your case this will return an array of items, you may simply want to grab
the first element of that array. I would hope that after that change your code
might work. Matt From: Hello Everyone, I really need your help understanding the Drop of the Drag
& Drop. I am trying to ‘drop’ an image from a
‘tileList’ onto a canvas, but I am having issues with creating the
child in the canvas. I am very new to ActiveScript and Flex, and
I’m sorry if this has been covered. Here is the drop code: ---------------------------------- function doDragDrop(event) {
doDragExit(event); var
item = event.dragSource.dataForFormat("product");
Alert.show(item[0], "Alert Box",Alert.OK); if
(item != undefined) {
item.mapX = event.target.mouseX - item.mouseInitX;
item.mapY = event.target.mouseY - item.mouseInitY; }
cvsPage.createChild(mx.controls.Image,"newTxtFld"+item, {x:'xLoc',
y:'yLoc'}); } --------------------------------- As you can see, I have taken some sample code and
I’m trying to apply it my needs (learning by example), but I have no idea
where I am going wrong. I am having a hard time finding an example of
dragging an image from a list and dropping (creating) on a canvas. Additional Questions ------------------------------ Why am I not getting a value to display in the alert box? What does the dataForFormat(“STRING”) refer
to? Is this just an arbitrary name? *****
***** Many thanks for the help in advance. ~David T. Yahoo! Groups Links
|