Page 1 of 1

switch not working on ServerSide ActionScript

Posted: 17 Oct 2007, 14:11
by Francois
Not really a problem because we simply need to use the if statement...

Not working

Code: Select all

...
switch(evt.name)
{
case "userJoin":
trace("hello");
break;
}
...
use if instead
Working

Code: Select all

...
if(evt.name=="userJoin")
{
trace("hello");
}
...
But it can makes you loose some time...

-François-

Posted: 19 Oct 2007, 12:46
by Lapo
Interesting point.
The switch is not working because the String you're checking is not a native Actionscript string but it's coming from the JVM as java.lang.String

In order to make it work you would probably need something like this:

Code: Select all

switch( String(evt.name) )
{
   case "userJoin":
   trace("hello");
   break;
} 

Posted: 19 Oct 2007, 13:29
by Francois
Thank you for your answer Lapo! :D