switch case variable in a ServerSide ActionScript Extension

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 case variable in a ServerSide ActionScript Extension

Post by Francois »

In my extension,
i have something like that:
NOT WORKING...

Code: Select all

var maxUserForThisRoom = 2;
switch(userOnline)
{
case 1:
trace("first user");
break;

case maxUserForThisRoom:
trace("close the room");
break;
}

WORKING...

Code: Select all

switch(userOnline)
{
case 1:
trace("first user");
break;

case 2:
trace("close the room");
break;
}

It isn't working as in client side action it does work !

Well for my part,
I'll change my switch into a if/else statement...
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

what error do you get when you run the non-working example?
Lapo
--
gotoAndPlay()
...addicted to flash games
Francois
Posts: 35
Joined: 15 Mar 2006, 14:00

Post by Francois »

I have no error in the console, the code the "case" is simply skipped.
patso
Posts: 380
Joined: 13 Nov 2006, 13:44
Location: Sofia, Bulgaria

Post by patso »

Check your code again(or even beter post it here).
On my SFS 1.5 it's looks like it's works.
This code:

Code: Select all

var maxUserForThisRoom = 2;
var userOnline = 1; 
switch(userOnline) 
{ 
	case 1: 
		trace("first user"); 
		break; 

	case maxUserForThisRoom: 
		trace("close the room"); 
		break; 
}
Output:

Code: Select all

first user
This code:

Code: Select all

var maxUserForThisRoom = 2;
var userOnline = 2; 
switch(userOnline) 
{ 
	case 1: 
		trace("first user"); 
		break; 

	case maxUserForThisRoom: 
		trace("close the room"); 
		break; 
}

Output:

Code: Select all

close the room
Post Reply