This content has been marked as final. Show 5 replies
You want to use the dragDrop event. Add a listener and then use the event.currentTarget property which has the source of your data you just dropped.
The on line help has a nice example to go through here:
Thanks, I figured it out already. It was kind of like that. The problem is, after it has been dropped and a user chooses a new photo, how do you know which photo it is. In this case, I need the price of the object. So, utilizing this:
var chld:String = event.dragInitiator.name;
var obj:DisplayObject = cvs.getChildByName(chld);
var ndx:int = cvs.getChildIndex(obj);
I was able to get the index of the object and look it up from the array that I had objects being pushed to. This solved it.
assign the name you want to call it with! Image, by virtue of being a DisplayObject, has name property:
var items:Array = event.dragSource.dataForFormat("items") as Array;
var img:Image = new Image()
img.name = "myImageName";
That is true for the first object, but what I keep trying to explain ( failing to do so obviously ;o) ) is that the user could pick the first photo or the third or the last one and choose to remove it from the canvas. I need to get that photos price and subtract it. I have it all working now.
Thanks for everyones input. It helps out on late nights like this.
After revisting Atta707's last post, I realized that by making my own name and pushing that to an array, I could look it up later. Cool!