# Checking for charAt string

**URL:** <https://forum.kirupa.com/t/checking-for-charat-string/320738>\
**Category:** flash\
**Created:** [March 31, 2011, 6:41pm UTC](https://forum.kirupa.com/t/checking-for-charat-string/320738 "2011-03-31T18:41:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![red2034](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@red2034](https://forum.kirupa.com/u/red2034)\
**Post date:** [March 31, 2011, 6:41pm UTC](https://forum.kirupa.com/t/checking-for-charat-string/320738/1 "2011-03-31T18:41:04Z")

</div>

Anybody see an issue with the code block below?!?!?!  
AS2 , and I have double checked the names. I am feeding in xml text to a button then trying to check to see if the button has ‘_’ as first character then delete the '_’ from the string…

```auto
box4.onRollOver = function():Void {
 this.gotoAndStop("over");
 alert4._visible = false;
};
box4.onRollOut = function():Void {
 this.gotoAndStop("hold");
 alert4._visible = true;
};
if (A1D4.A1D4text.htmlText.charAt(1) == "*"){
  A1D4.A1D4text.htmlText = A1D4.A1D4text.htmlText.substr(2, A1D4.A1D4text.htmlText.length);
  box4.onRelease = function():Void {
  stopAllSounds();
  gotoAndStop("right1");
  }
 }else{
  box4.onRelease = function():Void {
  stopAllSounds();
  gotoAndStop("wrong1");
  }
}

```
