userExits evt.userId is not number

You think you've found a bug? Please report it here.

Moderators: Lapo, Bax

Post Reply
Virusescu
Posts: 260
Joined: 07 Sep 2005, 09:36
Location: [RO]Bucharest
Contact:

userExits evt.userId is not number

Post by Virusescu »

When handling userExits internal event, one would expect the evt.userId to be a number but it is a java.lang.String - I think
This could bother you when trying to get the user object that just quit the room.
Using _server.getUserById(evt.userId) would yeld this error
org.mozilla.javascript.EvaluatorException: Can't find method it.gotoandplay.smar
tfoxserver.SmartFoxServer.getUserById(java.lang.String). (thu_challenge.as#255)
at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultError
Reporter.java:95)
at org.mozilla.javascript.Context.reportRuntimeError(Context.java:966)
at org.mozilla.javascript.Context.reportRuntimeError(Context.java:1022)
at org.mozilla.javascript.Context.reportRuntimeError1(Context.java:985)
However... if used like _server.getUserById(Number(evt.userId)) it works ok...
function onJoin(usr) {if (usr.getName() == "Lapo") trace ("All Hail Lapo");}
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Thanks for spotting it,
we'll add this fix in the next release.

:)
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply