# Dynamic Text Box Questions: Easy Enough

**URL:** <https://forum.kirupa.com/t/dynamic-text-box-questions-easy-enough/34825>\
**Category:** flash\
**Created:** [November 6, 2003, 9:30pm UTC](https://forum.kirupa.com/t/dynamic-text-box-questions-easy-enough/34825 "2003-11-06T21:30:09Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![REEF](https://avatars.discourse-cdn.com/v4/letter/r/ce73a5/32.png) [@REEF](https://forum.kirupa.com/u/REEF)\
**Post date:** [November 6, 2003, 9:30pm UTC](https://forum.kirupa.com/t/dynamic-text-box-questions-easy-enough/34825/1 "2003-11-06T21:30:09Z")

</div>

Here are some questions:[list=1]  
[_]How would I set a certain dynamic text boxes color of the outer border and the inner background? I’ve seen many sites do this. I don’t like making a rectangle for it seperately.  
[_]How would I make it so that, like for an input textbox, before you type anything in, it shows: **Please Input a Name** , and after you click in the input text box, before you start typing, the textbox clears the text.[/list]

- 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:** [November 6, 2003, 9:55pm UTC](https://forum.kirupa.com/t/dynamic-text-box-questions-easy-enough/34825/2 "2003-11-06T21:55:12Z")

</div>

first question:

[AS]txt.backgroundColor = 0xFFFF00;//yellow bg  
txt.borderColor = 0xFF0000;//red border[/AS]

where “txt” is the instancename of your textfield. You must select border in the propertypanel.

scotty(-:

---

<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:** [November 6, 2003, 9:57pm UTC](https://forum.kirupa.com/t/dynamic-text-box-questions-easy-enough/34825/3 "2003-11-06T21:57:24Z")

</div>

> You must select border in the propertypanel.

Yea, heh, I figured that much by now. Lol, thanks a lot. Now I just need the second question.

---

<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:** [November 6, 2003, 10:03pm UTC](https://forum.kirupa.com/t/dynamic-text-box-questions-easy-enough/34825/4 "2003-11-06T22:03:07Z")

</div>

```auto

txt.text = "Please enter name"

```

2nd part i forget exact syntax but u need to use set foucs

---

<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:** [November 6, 2003, 10:04pm UTC](https://forum.kirupa.com/t/dynamic-text-box-questions-easy-enough/34825/5 "2003-11-06T22:04:36Z")

</div>

second:  
make your txtfield a movieclip (“tekst”)  
txtfield variable =input  
just type what you want in your txtfield and use this code: [AS]tekst.txt.backgroundColor = 0xFFFF00;  
tekst.txt.borderColor = 0xFF0000;  
tekst.onPress = function(){  
tekst.input = “”;  
}[/AS]

scotty

---

<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:** [November 6, 2003, 10:24pm UTC](https://forum.kirupa.com/t/dynamic-text-box-questions-easy-enough/34825/6 "2003-11-06T22:24:21Z")

</div>

Nah, it doesn’t work. I put the input textbox into a movie clip. It’s instance name is **tekst**. It’s variable is **input**. And the actionscript on the first keyframe inside the MC is: [AS]tekst.text = “Please Enter Name”;  
tekst.backgroundColor = 0x212121;  
tekst.borderColor = 0x000000;  
tekst.onPress = function() {  
tekst.input = “”;  
};

```auto

Why's it not working?
```

---

<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:** [November 6, 2003, 10:32pm UTC](https://forum.kirupa.com/t/dynamic-text-box-questions-easy-enough/34825/7 "2003-11-06T22:32:19Z")

</div>

[AS]tekst.input = “Please Enter Name”;  
tekst.txt.backgroundColor = 0x212121;  
tekst.txt.borderColor = 0x000000;  
tekst.onPress =function () {  
tekst.input = “”;  
}; [/AS]

first line you had tekst.text and you forgot the instancename of your txtfield

scotty:smirk:

---

<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:** [November 7, 2003, 10:49pm UTC](https://forum.kirupa.com/t/dynamic-text-box-questions-easy-enough/34825/8 "2003-11-07T22:49:39Z")

</div>

//Bump

- No man, you code doesn’t work. To make it have “Please Enter Your Name”, I took off the **tekst** part of the code. To make it have the colored textbox, I took off the **.txt** part of the code. And the last part definetly doesn’t work. Is onPress a function that’ll work for input textboxes?

- Try to fix what I might be doing 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:** [November 7, 2003, 10:59pm UTC](https://forum.kirupa.com/t/dynamic-text-box-questions-easy-enough/34825/9 "2003-11-07T22:59:42Z")

</div>

```auto
tekst.text = "Please Enter Name";
tekst.backgroundColor = 0x212121;
tekst.borderColor = 0x000000;
tekst.onSetFocus = function() {
	this.text = "";
	this.onSetFocus = undefined;
};
//
var input = "Please Enter Name";
tekst.backgroundColor = 0x212121;
tekst.borderColor = 0x000000;
tekst.onSetFocus = function() {
	input = "";
	this.onSetFocus = undefined;
};

```

---

<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:** [November 7, 2003, 11:04pm UTC](https://forum.kirupa.com/t/dynamic-text-box-questions-easy-enough/34825/10 "2003-11-07T23:04:33Z")

</div>

kode has beaten me.  
here’s the fixed fla

---

<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:** [November 7, 2003, 11:19pm UTC](https://forum.kirupa.com/t/dynamic-text-box-questions-easy-enough/34825/11 "2003-11-07T23:19:27Z")

</div>

Yea Alright Kode! Thanks a lot man!

---

<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:** [November 7, 2003, 11:35pm UTC](https://forum.kirupa.com/t/dynamic-text-box-questions-easy-enough/34825/12 "2003-11-07T23:35:43Z")

</div>

You’re welcome, Sharif. 😉
