Drag map

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

Moderators: Lapo, Bax

laxersaz
Posts: 50
Joined: 30 Nov 2009, 16:19
Contact:

Drag map

Postby laxersaz » 10 Feb 2010, 10:56

Hello again!

I'd like to implement map dragging so that the player can have a look around on the map (similar to FarmVille). Is the panView method the only way to accomplish that? And if so, is it possible to eliminate the flashing so that a continuous map dragging can be achieved?
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 10 Feb 2010, 13:52

I don't think dragging the map with the mouse can be achieved. During panning, the engine adds/removes tiles to/from the stage: doing this live, while the user moves the mouse, would hit the performance considerably.

About the "flash" effect during panning, just pass showAnimation=true to the OpenSpace.panView method (fourth parameter): map will pan smoothly, without "jumping" to the new position showing the flash effect.
Paolo Bax
The SmartFoxServer Team
laxersaz
Posts: 50
Joined: 30 Nov 2009, 16:19
Contact:

Postby laxersaz » 10 Feb 2010, 13:55

Alright, thanks!
laxersaz
Posts: 50
Joined: 30 Nov 2009, 16:19
Contact:

Postby laxersaz » 10 Feb 2010, 16:57

If I call the panView method like this (_openSpace is my valid OpenSpace 2 instance), I immediately get an error as follots

Code: Select all

_openSpace.panView(100, 100, false, false);


Exception fault: ArgumentError: Error #2025: Das angegebene DisplayObject muss ein untergeordnetes Element des Aufrufers sein.
at flash.display::DisplayObjectContainer/removeChild()
at com.smartfoxserver.openspace.engine.control.map::EngineMapRenderer/onTransitionEffectComplete()
[/Users/Paolo/gotoAndPlay/gotoAndPlay/SmartFoxServer/OpenSpace/Client/Classes/src/com/smartfoxserver/openspace/engine/control/map/EngineMapRenderer.as:1060]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.greensock::TweenMax/complete()[/Users/benjaminbischoff/Documents/Workspace/Presentation2/libsrc/com/greensock/TweenMax.as:778]
at com.greensock::TweenMax/renderTime()[/Users/benjaminbischoff/Documents/Workspace/Presentation2/libsrc/com/greensock/TweenMax.as:757]
at com.greensock.core::SimpleTimeline/renderTime()[/Users/benjaminbischoff/Documents/Workspace/Presentation2/libsrc/com/greensock/core/SimpleTimeline.as:74]
at com.greensock::TweenLite$/updateAll()[/Users/benjaminbischoff/Documents/Workspace/Presentation2/libsrc/com/greensock/TweenLite.as:616]
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 10 Feb 2010, 21:49

We tested this, both in Flash and Flex, and no error is thrown.
There must be something else going on.
What about the example we provided? Did you test it? Same error?
It seems you are using Greensock's Tween classes. They are contained in the OpenSpace package too... maybe there's some kind of incompatibility? Try using the classes from the OpenSpace package.
Paolo Bax
The SmartFoxServer Team
warhell
Posts: 199
Joined: 18 Aug 2007, 16:49
Location: Silicon Valley, CA
Contact:

Postby warhell » 01 Apr 2010, 00:44

I actually would like to implement a pan where I just move the Openspace component. I'm working with a very small map, so I don't really need Opensapce to delete tiles.

One of the issues I'm having with this though, is that the user needs to be able to pan while in edit mode, but I don't want the user to be able to do this while the user is moving around furniture. Is there any event that will let me know when the user is moving around furniture within Openspace? I tried using the "onItemClicked" handler, but that only seems to go off when you click on it and not when you drag the item.
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 01 Apr 2010, 06:57

Actually there's no sort of "start drag" event, but when the user starts dragging a map item, that item is removed from the map and you get an OpenSpaceEvent.MAP_ITEM_REMOVED event. Not sure this is enough. Maybe we can add those drag events...
Paolo Bax
The SmartFoxServer Team

Return to “OpenSpace v2 discussions and help”

Who is online

Users browsing this forum: No registered users and 32 guests