String from array is being weird :S

Hi all, I’m trying to get my simple tickerbox to work. It should tick out the message that was found in an array. This is my code:


function TextScroll(Val) {
	for(i=0; i<MyArray.length; i++) {
		if (MyArray*[0] == Val) {
			rollScroll(MyArray*[0],MyArray*[1]); // Name, text
		}
	}
}

function RollScroll(NAME,TEXT) {
	var a:Number = 0;
	var thisText:String = TEXT;

	_root.scroll.name.text = NAME;

	onEnterFrame = function() {
		_root.scroll.input.text = thisText.substr(0,a);
		a++;
	}
}

Well, all seems to work UNTILL i get to

onEnterFrame = function() {
 		_root.scroll.input.text = thisText.substr(0,a);
 		a++;
}

Because I use substr() on my variable (which was defined as a string) I get the message “Undefined”. When I leave the substr() away it goes well, but then I won’t have my ticker effect.

Any thoughts? Thanks A LOT in advance!