Ryan
Ryan

Reputation: 10049

ActionScript 3: get the first character from the first element of an array

I am learning AS3 (coming from a PHP background) and I have hit a wall.

Basically I have this code:

var activeNotesNames:Array;
activeNotesNames = new Array;

activeNotesNames.push("ABC");

and doing a

trace(activeNotesNames[0])

gives me "ABC" but if I just want the first character (in this case that would be "A") how do I get that?

I tried trace(activeNotesNames[0][0] but that gives me an error.

Upvotes: 1

Views: 3154

Answers (1)

Pan
Pan

Reputation: 2101

activeNotesNames[0].charAt(0);

Or you can try substr

Upvotes: 3

Related Questions