Page 1 of 1

handleInternalEvent evt.name

Posted: 08 Aug 2008, 14:34
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

Posted: 08 Aug 2008, 15:05
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