Converting from a string to a numeric

Hi,
I have an mc.instance name is Twentysecond
it has a text box called label
When clicked Twentysecond populates a text box and I want to use this code
Flash will not let me use an instance name of 22nd.

TwentySecond.label = _name;//(I want this to show 22)

onRelease = function(){
myTextBox = _name; // (I want this to show 22nd
}

I should know how to do this, but memory is failing, hoping some kindly soul can jog it along for me.
Any help appreciated

Cheers

SteveD

I don’t understand what’s happening :-\ And what SHOULD happen :sleep: Can you explain where you put your codes?[SIZE=1]■■■■ Frenchmen…[/SIZE]

Hi ilyaslamasse,
When I re - read that post - neither did I understand it (lol!!!) well it is early here !
Anyways, I am halfway there myself, I had made a basic typo and discovered that I can give my instance a name of 22nd
What I need is the correct syntax for indexOf. so that I can remove the nd
Do you know that ilya ? does anyone else ?

Cheers

StevD

C’est dans la doc :trout:

String.indexOf(“taStringQueTuCherches”);

pom :crazy:

Hi,
OK, I got it eventually, a beter description is that I have 31 mc’s representing the days of the month, they are called 1st 2nd 3rd and so on until…31st
What I needed to do was strip out the letters after the numbers so that they appeared in a text box ( label) as 1 2 3 4 and so on
The objective being to use as little AS as possible - this what I came up with for those of you that are following this thread

if(!_name.substr(0,2)){
this.label = _name.substr(0, 1);
} else {
this.label = _name.substr(0, 2);
}

It works perfectly

Cheers

SteveD