# \_root.blah.text.getLength?

**URL:** <https://forum.kirupa.com/t/-root-blah-text-getlength/18431>\
**Category:** Uncategorized\
**Created:** [April 16, 2003, 6:14pm UTC](https://forum.kirupa.com/t/-root-blah-text-getlength/18431 "2003-04-16T18:14:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shuga](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@shuga](https://forum.kirupa.com/u/shuga)\
**Post date:** [April 16, 2003, 6:14pm UTC](https://forum.kirupa.com/t/-root-blah-text-getlength/18431/1 "2003-04-16T18:14:29Z")

</div>

how do i get the length of a text box for use in a function

i have two text boxes on the \_root … ‘fn’ and ‘ln’

and a function that says:

```php

_root.ln._x = _root.fn._x+((_root.fn.text.getLength)*8)+10;

```

it’s last name and first name and i want the last name to be 10 pixels or so after the first name but since names are different lengths i figured i should do the number of characters times the approx. pixel width of a character plus the value of the space i want between the two fields

can someone help me make this work?

thanks =)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 16, 2003, 6:21pm UTC](https://forum.kirupa.com/t/-root-blah-text-getlength/18431/2 "2003-04-16T18:21:05Z")

</div>

here’s a way…set the fn’s registration point to the middle right, and ln to the middle left…then just enter however many pixels you want there to be between them, and they’ll adjust accordingly…i believe you should use \_xposition…however i may be wrong…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 16, 2003, 6:32pm UTC](https://forum.kirupa.com/t/-root-blah-text-getlength/18431/3 "2003-04-16T18:32:09Z")

</div>

right … that would work … but then it would look awkward b/c the position of the name would change based on the length … it’d be like having centered text

the interface looks like

Name: \_\_\_\_\_\_\_\_\_\_\_\_\_\_  
Phone: \_\_\_\_\_\_\_\_\_\_\_\_\_\_  
Email: \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_

so if phone and email are aligned left and name is aligned center … .that would look funny

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 16, 2003, 6:35pm UTC](https://forum.kirupa.com/t/-root-blah-text-getlength/18431/4 "2003-04-16T18:35:08Z")

</div>

is it possible to make the textbox change length depending on the text inside?  
you could also align the fn box right(the text inside that is) and the ln box left

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 16, 2003, 6:41pm UTC](https://forum.kirupa.com/t/-root-blah-text-getlength/18431/5 "2003-04-16T18:41:43Z")

</div>

solution:

```php

onEnterFrame = function () {
	_root.ln._x = _root.fn._x+((_root.fn.text.length)*8)+7;
};

```

thanks =)
