Getting OpenSpace to initialize in actionscript
Posted: 26 Jul 2011, 19:59
I'm creating a game using the FlashBuilder 4.0 IDE but not using any of the Flex MXML, everything is written in AS3. I've been able to get SmartFox 2x to connect correctly & even create a room. Now I need to add in OpenSpace to the code. I've looked at the os1Example code carefully and as fat as I can tell I've done everything correctly but I don't get the OpenSpaceEvent.INITIALIZED event.
I'd really like to know what I've left out. Pleas just don,t say look at the Client API, give me a citation to where to look exactly.
Bellow here is the code segments
I'd really like to know what I've left out. Pleas just don,t say look at the Client API, give me a citation to where to look exactly.
Bellow here is the code segments
Code: Select all
import com.smartfoxserver.openspace.components.flash.OpenSpace;
import com.smartfoxserver.openspace.engine.control.events.OpenSpaceEvent;
import com.smartfoxserver.openspace.engine.model.other.MapCenteringParams;
import com.smartfoxserver.openspace.shared.control.events.LoggerEvent;
Code: Select all
_sfs = new SmartFox(true);
_sfs.debug = true;
_openSpace = new OpenSpace();
Code: Select all
private function onLogin(evnt:SFSEvent):void
{
if(mLoginScreen != null)
{
mUserName = mLoginScreen.UserNameInput.text;
mUserPassword = mLoginScreen.PasswordInput.text;
Display.removeChild(Display.getChildByName("LoginScreen"));
}
dTrace("Login successful - UserName: "+ mUserName + " & Password " + mUserPassword);
mEventManager.removeEventListener(Display, TextEvent.TEXT_INPUT, onLoginInputChange, true);
mEventManager.removeEventListener(Display, TextEvent.TEXT_INPUT, onLoginInputChange, true);
_sfs.addEventListener(SFSEvent.ROOM_ADD, onRoomCreated);
_sfs.addEventListener(SFSEvent.ROOM_CREATION_ERROR, onRoomCreationError);
mMainUI.mainScreen.visible = true;
Display.addChild(_openSpace);
initializeOpenSpace();
}