switch not working on ServerSide ActionScript

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

Moderators: Lapo, Bax

Post Reply
Francois
Posts: 35
Joined: 15 Mar 2006, 14:00

switch not working on ServerSide ActionScript

Post 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-
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post 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;
} 
Lapo
--
gotoAndPlay()
...addicted to flash games
Francois
Posts: 35
Joined: 15 Mar 2006, 14:00

Post by Francois »

Thank you for your answer Lapo! :D
Post Reply