Listening for the drag_start event

Post here your questions about the OpenSpace 2.x or notify bugs and suggestions.

Moderators: Lapo, Bax

Post Reply
warhell
Posts: 199
Joined: 18 Aug 2007, 16:49
Location: Silicon Valley, CA
Contact:

Listening for the drag_start event

Post by warhell »

Hello, I was wondering if it's possible to listen for the drag_start event from openspace (I need to do a hack in which I need to find out the height of the item I am dragging).

I been trying to do the following, and the listeners are not being called...

Code: Select all

openspace.addEventListener(DragEvent.DRAG_START,onopenspaceDragStart);
			openspace.getChildAt(0).addEventListener(DragEvent.DRAG_START,onopenspaceDragStart);
Any suggestions?
SmartFoxServer and OpenSpace developer
www.edgarmiranda.net
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

OpenSpace doesn't fire that kind of event, but on drag start you always have a MAP_ITEM_REMOVED event. It only returns the inventory item id, but maybe it is enough for you to retrieve its height, taking it from the inventory.
Paolo Bax
The SmartFoxServer Team
warhell
Posts: 199
Joined: 18 Aug 2007, 16:49
Location: Silicon Valley, CA
Contact:

Post by warhell »

bax wrote:OpenSpace doesn't fire that kind of event, but on drag start you always have a MAP_ITEM_REMOVED event. It only returns the inventory item id, but maybe it is enough for you to retrieve its height, taking it from the inventory.
How would I get the height if I only have the inventory item id?

Actually, I have a better question (that would help me solve my issue). Is there a way to determine what the px and py value of the tile that was just removed, that is... the location of the tile before it was actually removed?
SmartFoxServer and OpenSpace developer
www.edgarmiranda.net
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

Actually not. The item removed event only returns the itemId.

Back to my suggestion, you could call the IOpenSpace. getInventoryItemSprite method passing the itemId (and a direction), and measure the height of the returned sprite. Of course you must have loaded the inventory previously.
Paolo Bax
The SmartFoxServer Team
Post Reply