# String from array is being weird :S

**URL:** <https://forum.kirupa.com/t/string-from-array-is-being-weird-s/164456>\
**Category:** flash\
**Created:** [October 1, 2005, 2:38pm UTC](https://forum.kirupa.com/t/string-from-array-is-being-weird-s/164456 "2005-10-01T14:38:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ferdi](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ferdi/32/689_2.png) [@Ferdi](https://forum.kirupa.com/u/Ferdi)\
**Post date:** [October 1, 2005, 2:38pm UTC](https://forum.kirupa.com/t/string-from-array-is-being-weird-s/164456/1 "2005-10-01T14:38:09Z")

</div>

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:

```php

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

```php
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!
