I’m trying to strip the name of a movieclip to just the number so that I can use it as a parameter in a function. The name of the movieclip is mcThumb6 and there are 8 different clips that are numbered 1 - 8. I’m trying to use the .split method to remove the mcThumb and just have the “6” remain. The movieclips all have rollover functions. The rollover event strips out the string and then will call a function using the number (based on which movieclip was rolled over). This is working except when I trace out the new value it adds a comma in front of the number – i.e. the output looks like this: ,6 instead of just 6.
Does anyone know where this comma is coming from?
The code:
mcNav.mcThumb6.addEventListener(MouseEvent.ROLL_OVER, thumbOver);
function thumbOver(e:MouseEvent):void
{
var curPosition:String;
curPosition = e.target.name.split(“mcThumb”);
trace("curPosition is " + e.target.name + " " + curPosition);
}
Thanks!!