Advanced Drag & Drop - Recognizing Other Container Objects
Hey folks. Scenario is as follows:
Situation: I'm making an inventory system for a RPG for my employer (small game developing company). There is a flash asset of an inventory page, with about 4 layers, 1 layer containing 7 children of the inventory, 3 other layers for shapes and what not... the entire project is in Flex Builder 3.0 now, and I'm embedding all the flash assets as a .swc file so I can create the object. I've added a VBox, and inside it I have 3 HBoxes, inside them I have lots of slots (Boxes) acting as holders for items. The items are added into the boxes. The items are UIComponent objects.
Problem: How can I access other boxes while I am dragging an item around? I've tried using the dropTarget property but it doesn't give me the parent of the item...which should be the box(acting as a slot or container), it gives me some other random art...and dropTarget property is read only. This means that I hold down the mouse button on top of an item, keep holding it an moving around, but when I move it around, I want other boxes to recognize that the item is over them. Note that these boxes are unique...there are 48 of them as mentioned, and they are all at the same level of depth.
Goal: Whenever I drag an item and drop it. I want it to snap into the middle of a box, based on positions. First and foremost, I need access to other box objects (parent of the item object) to make any circumstances for dropping.
Any help is appreciated. Thank you.
- Sakib I.
|