Page 1 of 1

createMyAvatar Issues

Posted: 18 Sep 2009, 22:01
by starzero
Hello,

When I invoke the createMyAvatar method from the open space object, I am receiving the following error:

method invokation

Code: Select all

_os.createMyAvatar("WalkingAvatar", null, skin, null, 0);

Code: Select all

TypeError: Error #1009: Cannot access a property or method of a null object reference.
	at com.smartfoxserver.openspace.mvc::IsoEngineModel/createAvatar()
	at com.smartfoxserver.openspace::OpenSpace/createMyAvatar()
	at com.teampalz::World/_onAvatarAssetsRetrieved()[C:\Users\Paul\teampalz_workspace\TPZ_TRUNK\dev\lib\as3\com\teampalz\World.as:272]
	at flash.events::EventDispatcher/dispatchEventFunction()
	at flash.events::EventDispatcher/dispatchEvent()
	at com.teampalz::Seed/_sfs_onExtensionResponse()[C:\Users\Paul\teampalz_workspace\TPZ_TRUNK\dev\lib\as3\com\teampalz\Seed.as:195]
	at flash.events::EventDispatcher/dispatchEventFunction()
	at flash.events::EventDispatcher/dispatchEvent()
	at it.gotoandplay.smartfoxserver.handlers::ExtHandler/handleMessage()[C:\Users\Paul\teampalz_workspace\TPZ_TRUNK\dev\lib\as3\it\gotoandplay\smartfoxserver\handlers\ExtHandler.as:52]
	at it.gotoandplay.smartfoxserver::SmartFoxClient/xmlReceived()[C:\Users\Paul\teampalz_workspace\TPZ_TRUNK\dev\lib\as3\it\gotoandplay\smartfoxserver\SmartFoxClient.as:2673]
	at it.gotoandplay.smartfoxserver::SmartFoxClient/handleMessage()[C:\Users\Paul\teampalz_workspace\TPZ_TRUNK\dev\lib\as3\it\gotoandplay\smartfoxserver\SmartFoxClient.as:3014]
	at it.gotoandplay.smartfoxserver::SmartFoxClient/handleSocketData()[C:\Users\Paul\teampalz_workspace\TPZ_TRUNK\dev\lib\as3\it\gotoandplay\smartfoxserver\SmartFoxClient.as:2996]
My openspace config file is as follows:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<OpenSpace>
	<!-- Map rendering parameters -->
	<TileSize>60</TileSize>
	<TileRatio>0.5</TileRatio>
	<ShowTileElevation>1</ShowTileElevation>
	<ShowTilesGrid>0</ShowTilesGrid>
	<ShowTilesFill>0</ShowTilesFill>
	<TileCustomParamsSeparator>|</TileCustomParamsSeparator>
	<ProcessedTilesPerFrame>60</ProcessedTilesPerFrame>
	
	<!-- Controller parameters -->
	<ControllerType>mouse</ControllerType>
	<Use8Directions>1</Use8Directions>
	<UseHandCursor>0</UseHandCursor>
	
	<!-- Scrolling parameters -->
	<UseSmartScrolling>1</UseSmartScrolling>
	<ScrollSensorSize>10</ScrollSensorSize>
	<ScrollPercentage>50</ScrollPercentage>
	<ScrollTime>250</ScrollTime>
	<ScrollTransition>easeOutSine</ScrollTransition>
	<UseContinuousScrolling>1</UseContinuousScrolling>
	
	<!-- Avatar parameters -->
	<EnableAvatarMouseEvents>1</EnableAvatarMouseEvents>
	<UseHandCursorOnAvatars>1</UseHandCursorOnAvatars>
	<EnablePixelCollisionCheck>0</EnablePixelCollisionCheck>
	
	<AvatarTypes>
		<AvatarType type="WalkingAvatar" className="com.teampalz.avatars.WalkingAvatar" animTime="400" stature="30" />
	</AvatarTypes>
</OpenSpace>
I have verified that at least one walkable tile is active in the 0,0,0 position (just for testing).

Does this exception mean that the WalkingAvatar class cannot be instantiated?

I should note that our custom avatar is working in a modified version of the ranch example. Is there something specific in the backgrounds or skins fla that needs to link to the WalkingAvatar class or is that specifically a function of the openspace configuration to define this?

Your help is very much appreciated.

On another note, I have to say that the openspace editor is a bit rough around the edges. I sincerely hope that it evolves into a more usable product (especially since we just dropped the money to go ahead and purchase it). A short list of wish list features includes: undo, drag and drop of assetts on the map once they are placed, consistent saving mechanism, user feedback after a map is exported, etc.


Thanks!

Paul

Re: createMyAvatar Issues

Posted: 19 Sep 2009, 08:42
by Bax
I have verified that at least one walkable tile is active in the 0,0,0 position (just for testing).
If you are not passing specific coordinates to the createMyAvatar method, you need to have at least one "access point" defined on the map. Inside the Editor, click on a walkable tile on the map, open the tile instance properties pane and flag the tile as "access point".
On another note, I have to say that the openspace editor is a bit rough around the edges. I sincerely hope that it evolves into a more usable product (especially since we just dropped the money to go ahead and purchase it). A short list of wish list features includes: undo, drag and drop of assetts on the map once they are placed, consistent saving mechanism, user feedback after a map is exported, etc.
Some of your requests for the OS Editor are already in our todo list; we will do our best to cover most of your needs in the next releases.

Posted: 20 Sep 2009, 18:52
by starzero
Hi Bax,

Thank you for your prompt reply, I will try this tomorrow when I am able to. Is this information available in the online documentation just in case I missed it?

Thank you also for addressing the issues I have been having with the OS editor. I sincerely look forward to the improvements!

Thanks again!

Paul

Posted: 21 Sep 2009, 08:07
by Bax
Check the OpenSpace Editor documentation, where the Map Editor is described. The table describing the tile instance properties highlights the fact that a map must have at least one access point defined.