We need to have 2 buttons other than the remove button for a component that extends from "AbstractMapItemSelector"
These buttons would be: move and rotate
I know that rotating an item that is already placed on a map is not supported, that is why I intend to first "remove" it and then get the next orientation from the inventory
and place it where the object originally was in. I would do the same for moving map items, it would simply "remove" it and then attach it to the mouse so that the user can
place it elsewhere (This might be a completely different topic)
But anyways, I have the "move" button showing up when I select a map item when in EditMode, even though I made it as a Button class, it doesnt respond to mouse events (over,
down, etc) .
Does anyone know how to add more buttons to a CustomItemMapSelector? what if I wanted to make an Info button for any map item?
I noticed that the "button" property of the class return the remove button, but what if I need any other button on the map item, maybe Im missing something.
Thanx for the help
Here's some code of what I have
package
{
import flash.display.Sprite;
import flash.events.IEventDispatcher;
import com.smartfoxserver.openspace.shared.view.items.AbstractMapItemSelector;
import flash.display.MovieClip;
import flashx.textLayout.formats.BackgroundColor;
import flash.events.MouseEvent;
public class CustomMapItemSelector extends AbstractMapItemSelector
{
private var m_sprite;
private var m_background;
private var m_removeButton;
private var m_rotateButton;
private var m_moveButton;
private var m_moveCallBack:Function;
private var m_rotateCallback:Function;
public function CustomMapItemSelector()
{
super();
m_itemSelector = new ItemSelectorLibrary();
m_sprite = null;
super.addChild(m_itemSelector);
}
//Properties
public override function get button():IEventDispatcher
{
return m_removeButton;
}
public override function get isESCEnabled():Boolean
{
return super.isESCEnabled;
}
public override function get sprite():Sprite
{
return m_sprite;
}
public function set MoveCallback(func:Function):void
{
m_moveCallBack = func;
}
public function set RotateCallback(func:Function):void
{
m_rotateCallback = func;
}
//Functions
public override function clear():void
{
}
public override function render (spr:Sprite, params:Object):void
{
if(m_sprite != null){
m_itemSelector.removeChild(m_sprite);
}
if(m_background != null){
m_itemSelector.removeChild(m_background);
}
if(m_removeButton != null){
m_itemSelector.removeChild(m_removeButton);
}
if (m_rotateButton != null){
m_itemSelector.removeChild(m_rotateButton);
}
if (m_moveButton != null){
m_itemSelector.removeChild(m_moveButton);
}
m_sprite = spr;
m_background = new background();
m_itemSelector.addChild(m_background);
m_background.height = m_sprite.height+10;
m_background.width = m_sprite.width+10;
m_sprite.x = 5;
m_sprite.y = 5;
m_itemSelector.addChild(m_sprite);
m_removeButton = new removeButton();
m_removeButton.x = m_background.width;
m_itemSelector.addChild(m_removeButton);
m_moveButton = new moveButton();
m_moveButton.x = m_background.width + 35;
m_itemSelector.addChild(m_moveButton);
m_moveButton.addEventListener(MouseEvent.MOUSE_OVER,mouseOverMove);
m_moveButton.addEventListener(MouseEvent.MOUSE_OUT,mouseOutMove);
/*m_rotateButton = new rotateButton();
m_rotateButton.x = m_background.width + 60;
m_itemSelector.addChild(m_rotateButton);*/
}
private function mouseOverMove(e:MouseEvent):void
{
m_moveButton.GoToAndStop(2);
}
private function mouseOutMove(e:MouseEvent):void
{
m_moveButton.GoToAndStop(1);
}
}
}
- Board index OpenSpace Support OpenSpace v2 discussions and help
- Search
-
- It is currently 11 Feb 2026, 03:33
- All times are UTC
ItemMapSelector with more than 1 button
Post here your questions about the OpenSpace 2.x or notify bugs and suggestions.
Return to “OpenSpace v2 discussions and help”
Jump to
- SmartFoxServer 2X
- ↳ SFS2X Questions
- ↳ SFS2X Client API
- ↳ SFS2X ActionScript 3 API
- ↳ SFS2X C# API
- ↳ SFS2X iPhone / iPad / OSX API
- ↳ SFS2X Java / Android API
- ↳ SFS2X HTML5 / JavaScript API
- ↳ SFS2X C++ API
- ↳ RedBox 2X
- ↳ 2X Features Wish List
- SmartFoxServer Pro/Basic 1.x
- ↳ SmartFoxServer 1.x Discussions and Help
- ↳ Server Side Extension Development
- ↳ BlueBox
- ↳ RedBox
- ↳ Features Wish List
- ↳ The Bug Trap
- ↳ Client API - SFS 1.x
- ↳ .Net / Unity3D API
- ↳ iPhone Objective-C API
- ↳ Silverlight API
- ↳ Java2SE / Android Client API
- ↳ Other Client API
- OpenSpace Support
- ↳ OpenSpace v2 discussions and help
- ↳ OpenSpace v1 discussions and help
- SmartFoxBits Support
- ↳ SmartFoxBits for SFS 2X
- ↳ SmartFoxBits for SFS 1.x
- Community
- ↳ Job offers and requests
- ↳ The Gallery