# \[MX\] Disable an input text box

**URL:** <https://forum.kirupa.com/t/mx-disable-an-input-text-box/7413>\
**Category:** flash\
**Created:** [October 30, 2002, 3:40pm UTC](https://forum.kirupa.com/t/mx-disable-an-input-text-box/7413 "2002-10-30T15:40:44Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![GregD](https://avatars.discourse-cdn.com/v4/letter/g/a183cd/32.png) [@GregD](https://forum.kirupa.com/u/GregD)\
**Post date:** [October 30, 2002, 3:40pm UTC](https://forum.kirupa.com/t/mx-disable-an-input-text-box/7413/1 "2002-10-30T15:40:44Z")

</div>

Hey Guys,

Just a quick question… I currently have a button which checks to see if the values of text boxes are correct before displaying a tick or a cross to indicate this.

I want to disable the input text boxes so no data can be written into them once they are correct…

So my code so far within the button:

on (release) {  
if (input1 == “140” && input2 == “180” && input3 == “140” && input4 == “180” && input5 == “640”) { //if these values are entered in the input boxes \<input1\> etc.  
setProperty(\_root.ticka, \_visible, true); //tick becomes visible  
//code needs to go here for disabling input txt boxes  
} else {  
setProperty(\_root.crossa, \_visible, true); // cross becomes visible  
}  
}

I read up on some sites dedicated to flash/actionscripting but the closest i could find was this for an input text field:

yourTextField.onChanged = function() {  
yourTextField.selectable = false;  
};

I needed it within the if statement, so i couldnt figure out how it worked.

If anyone can help me on this ill be grateful 😉

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:** [October 30, 2002, 3:47pm UTC](https://forum.kirupa.com/t/mx-disable-an-input-text-box/7413/2 "2002-10-30T15:47:31Z")

</div>

Well, I don’t have Flash on that computer, but your best bet is to check the textfield methods in the AS Dictionary. Everything’s there. And if it is not there, it doesn’t exist.

pom :cowboy:

---

<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:** [October 30, 2002, 4:24pm UTC](https://forum.kirupa.com/t/mx-disable-an-input-text-box/7413/3 "2002-10-30T16:24:07Z")

</div>

What I usually do is have a mc with 0 alpha away from the stage and then setProperty to move it on to the text field. Make sure that the mc is on top of the text field. This way it blocks the input field and you cannot enter text once u have the correct answer. Hope this helps!

---

<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:** [October 30, 2002, 4:29pm UTC](https://forum.kirupa.com/t/mx-disable-an-input-text-box/7413/4 "2002-10-30T16:29:10Z")

</div>

Thanks, Ill try that out later… but yeah should work.

I was just wondering if there was a disabled/enabled option.

---

<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:** [October 30, 2002, 4:32pm UTC](https://forum.kirupa.com/t/mx-disable-an-input-text-box/7413/5 "2002-10-30T16:32:01Z")

</div>

I have never used this one and dont know how it works but you may want to try!

TextField.\_visible

---

<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:** [October 31, 2002, 12:41am UTC](https://forum.kirupa.com/t/mx-disable-an-input-text-box/7413/6 "2002-10-31T00:41:53Z")

</div>

you can set a textfield’s type to “input” (editable) or “dynamic” (not editable).

```auto

myTextField.type = "dynamic" // to disable, "input" to enable

```

---

<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:** [October 31, 2002, 9:29am UTC](https://forum.kirupa.com/t/mx-disable-an-input-text-box/7413/7 "2002-10-31T09:29:51Z")

</div>

Srinivas:

Your movie clip method doesnt work too well because you can still enter text into the input box… unless im doing something wrong, its on the layer above the textbox and i brought it to the front but it still lets me do things to the text box.

sbeener:

Ive used it like this

```
    setProperty(_root.ticka, _visible, true);
    myTextField.type = "dynamic";

```

I tried using instance variable names where it says myTextField and label names (where it says var in properties) and I cant seem to get it working…

I’ve tried setting a variable also

```
myTextField = input1.text;

```

This doesnt give me much joy either… I must be doing something wrong but I don’t understand what. Can anyone shed some light on this ? 🙂

---

<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:** [October 31, 2002, 9:57am UTC](https://forum.kirupa.com/t/mx-disable-an-input-text-box/7413/8 "2002-10-31T09:57:04Z")

</div>

Srinivas:

Got it now thanks man… i converted some Dynamic text to a movie clip and stuck it in front/made it become visible once someone got it right…

Thanks everyone for your help 🙂

---

<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:** [October 31, 2002, 3:27pm UTC](https://forum.kirupa.com/t/mx-disable-an-input-text-box/7413/9 "2002-10-31T15:27:03Z")

</div>

Sorry it was my mistake! I forgot to mention that the mc should have a rectangular or square box and then make the mc alpha as 0. The you will block it totally and you can not enter any text into the input box. If its an empty mc with alpha 0 this doesnt work.

---

<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:** [October 31, 2002, 6:21pm UTC](https://forum.kirupa.com/t/mx-disable-an-input-text-box/7413/10 "2002-10-31T18:21:58Z")

</div>

“myTextField” was just an arbitrary label for an imaginary textfield, you should replace that with the correct path.instanceName of your textfield.
