Skip to main content
Participant
May 21, 2008
Answered

Using Checkbox to enable/disable input text.

  • May 21, 2008
  • 12 replies
  • 3072 views
Can anyone help me with the Actionscript for having a checkbox when CHECKED it allows certain input text fields to be enabled, and when UNCHECKED they are disabled?

I am making a Shipping/Billing application and want it to have a checkbox so if they information is the same as the previous they can check the box and disable the fields.
This topic has been closed for replies.
Correct answer Ned Murphy
Sorry, I wasn't thinking, Try:

function clickHandler(event:MouseEvent):void {
inputtext.selectable = !event.target.selected;
}

Though it should have been selectable until you checked the checkbox since nothing set it false ahead of that.

12 replies

Ned Murphy
Legend
May 22, 2008
Unless this has changed for textfields between AS2 and AS3, you can also set the selectable property as true/false to enable/disable access.
kglad
Community Expert
Community Expert
May 22, 2008
assign your textfield's type property to be TextFieldType.DYNAMIC and TextFieldType.INPUT when you want to disable and enable it, resp.