handleInternalEvent evt.name

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

Moderators: Lapo, Bax

Post Reply
Poyz
Posts: 83
Joined: 28 Mar 2006, 14:27

handleInternalEvent evt.name

Post by Poyz »

Not sure if it's a bug, but the serverside evt.name taken from handleInternalEvent(evt) acts strange with the switch:

with this code nothing is traced

Code: Select all

function handleInternalEvent(evt) {
	
	switch (evt.name) {
		
		case "loginRequest":
			trace("login requested")
		break
		
	}
	
}
but if i use switch (String(evt.name)) it traces the login request.
this makes me thing that evt.name is not a string but if before the switch i trace(evt.name == "loginRequest") the output is true
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Yes, the string is coming from the Java environment so it's a java.lang.String instead of an Actionscript native String.

Casting will do the trick, or you could use if-else and avoid type casting
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply