# \[AS2\] Changing text in dynamic text field with dynamic instance name

**URL:** <https://forum.kirupa.com/t/as2-changing-text-in-dynamic-text-field-with-dynamic-instance-name/277046>\
**Category:** flash\
**Created:** [December 6, 2008, 6:55pm UTC](https://forum.kirupa.com/t/as2-changing-text-in-dynamic-text-field-with-dynamic-instance-name/277046 "2008-12-06T18:55:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xstevey\_bx](https://avatars.discourse-cdn.com/v4/letter/x/91b2a8/32.png) [@xstevey\_bx](https://forum.kirupa.com/u/xstevey_bx)\
**Post date:** [December 6, 2008, 6:55pm UTC](https://forum.kirupa.com/t/as2-changing-text-in-dynamic-text-field-with-dynamic-instance-name/277046/1 "2008-12-06T18:55:08Z")

</div>

I dont know what I am missing here but what I want to do is change the text inside a dynamic text field via actionscript. the code I am using runs in a loop within a function. Trace is outputting the correct values.

```php

	for(i=0; i<=4; i++) {
		if(_root["order_"+ q]* == 0) {
			["order_"+ i]text = "First";
			trace("first");
		} else if (_root["order_"+ q]* == 1) {
			["order_"+ i]text = "Second";
			trace("Second");
		} else if (_root["order_"+ q]* == 2) {
			["order_"+ i]text = "Third";
			trace("Third");
		} else if (_root["order_"+ q]* == 3) {
			["order_"+ i]text = "Fourth";
			trace("Fourth");
		} else if (_root["order_"+ q]* == 4) {
			["order_"+ i]text = "Fifth";
			trace("Fifth");
		}
	}

```

basically I want to do this -

```php
order_0.text = "First";

```

So how can I change this line to work as expected?

```php
["order_"+ i]text = "First";

```

EDIT- The instance names for the dynamic text fields are set 😉  
Thanks
