all groups > flash actionscript > february 2005 >
You're in the

flash actionscript

group:

is selectedNode a string?


is selectedNode a string? idgarabert
2/28/2005 6:31:00 PM
flash actionscript:
I'm having trouble getting the length of a node selected from a tree component.
I put it in a string:

var userChoice:String = evt.target.selectedNode;
// But then, this fails, I get "undefined" for the value of str_ct:
var str_ct:Number = userChoice.length

// But, if I put the variable "userChoice" into the text of a label component,
then evaluate its length, it works:
user_choice_fld.text = userChoice;
var str_ct:Number = user_choice_fld.text.length;
trace("character count is: " + str_ct;

What's the difference?

TIA,

Bert

Re: is selectedNode a string? Rothrock
2/28/2005 9:46:44 PM
Don't know. But my guess is that selectedNode is a Node. (Just a guess.) I
think you want this. var userChoice:String =
evt.target.selectedNode.toString(); I'm just making that up out of my head
cause I'm away from Flash at the moment. But I think that is about right. Check
the help files for toString(); Are you in MX04?
Re: is selectedNode a string? idgarabert
3/1/2005 12:10:49 PM
Thank you Rothrock. You nailed it.
AddThis Social Bookmark Button