0
New Here
,
/t5/animate-discussions/using-checkbox-to-enable-disable-input-text/td-p/401439
May 21, 2008
May 21, 2008
Copy link to clipboard
Copied
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.
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.
TOPICS
ActionScript
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
LEGEND
,
May 21, 2008
May 21, 2008
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.
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.
Community Expert
,
/t5/animate-discussions/using-checkbox-to-enable-disable-input-text/m-p/401440#M11601
May 21, 2008
May 21, 2008
Copy link to clipboard
Copied
assign your textfield's type property to be
TextFieldType.DYNAMIC and TextFieldType.INPUT when you want to
disable and enable it, resp.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/animate-discussions/using-checkbox-to-enable-disable-input-text/m-p/401441#M11602
May 21, 2008
May 21, 2008
Copy link to clipboard
Copied
Unless this has changed for textfields between AS2 and AS3,
you can also set the selectable property as true/false to
enable/disable access.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/animate-discussions/using-checkbox-to-enable-disable-input-text/m-p/401442#M11603
May 21, 2008
May 21, 2008
Copy link to clipboard
Copied
selectable won't work. you can still enter text in a
textfield whose text you cannot select.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Tremmie
AUTHOR
New Here
,
/t5/animate-discussions/using-checkbox-to-enable-disable-input-text/m-p/401443#M11604
May 21, 2008
May 21, 2008
Copy link to clipboard
Copied
Maybe I wasn't clear on what I am looking for, but I am
creating a Shipping / Billing input form, and if the user's
information is the same in the shipping as it is billing, I want
them to check a box to disable the boxes.
I think it will be something like the attached code, however this code only allows the input text boxes to be ENABLED when the checkbox is checked, not DISABLED.
I think it will be something like the attached code, however this code only allows the input text boxes to be ENABLED when the checkbox is checked, not DISABLED.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/animate-discussions/using-checkbox-to-enable-disable-input-text/m-p/401444#M11605
May 21, 2008
May 21, 2008
Copy link to clipboard
Copied
Unless I've missed something somewhere (which isn't
impossible), TextFields do not have an 'enabled' property. They
have a 'selectable' property that you can set as true or false.
Setting the selectable property false for an input text field
effectively disables it.
If you can't select it, you can't enter anything into it. You can probably have actionscript do it, but then you can have that done for dynamic fields as well.
So your code should be:
inputtext.selectable = true;
function clickHandler(event:MouseEvent):void {
inputtext.selectable = event.target.selected;
}
If you can't select it, you can't enter anything into it. You can probably have actionscript do it, but then you can have that done for dynamic fields as well.
So your code should be:
inputtext.selectable = true;
function clickHandler(event:MouseEvent):void {
inputtext.selectable = event.target.selected;
}
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Tremmie
AUTHOR
New Here
,
/t5/animate-discussions/using-checkbox-to-enable-disable-input-text/m-p/401445#M11606
May 21, 2008
May 21, 2008
Copy link to clipboard
Copied
I appreciate the responses but I am still not getting the
outcome I need. What your code does is makes the text field not
selectable until the checkbox is selected, but I need the text
field to be selectable ASLONG as the checkbox ISNT selected, and
once the function is activated (eg. checking the box), the text
field ISNT selectable until the box is unselected. Can anyone help
with that?
Also I was considering using the TextInput Component since it does have a .enabled = true; syntax.
Also I was considering using the TextInput Component since it does have a .enabled = true; syntax.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/animate-discussions/using-checkbox-to-enable-disable-input-text/m-p/401446#M11607
May 21, 2008
May 21, 2008
Copy link to clipboard
Copied
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.
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.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Tremmie
AUTHOR
New Here
,
/t5/animate-discussions/using-checkbox-to-enable-disable-input-text/m-p/401447#M11608
May 21, 2008
May 21, 2008
Copy link to clipboard
Copied
Wow that worked! Thank you! Can't believe my solution was
just one tiny !.
Thanks!
Thanks!
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/animate-discussions/using-checkbox-to-enable-disable-input-text/m-p/401448#M11609
May 21, 2008
May 21, 2008
Copy link to clipboard
Copied
You're welcome.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/animate-discussions/using-checkbox-to-enable-disable-input-text/m-p/401449#M11610
May 21, 2008
May 21, 2008
Copy link to clipboard
Copied
again, assigning an input textfield's selectable property to
false will NOT prevent text from being entered. it just prevents a
user from selecting the text (that they may have entered).
re-read my above message.
re-read my above message.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/animate-discussions/using-checkbox-to-enable-disable-input-text/m-p/401450#M11611
May 22, 2008
May 22, 2008
Copy link to clipboard
Copied
No need to reread, just a need to retest... and you're
right--learning new stuff every day! I always assumed that no
cursor meant no entry possible, so I never actually tried typing
anything. Luckily, it's nothing I have to alert any clients about
and change.
In that case, the following will work instead...
function clickHandler(event:MouseEvent):void {
inputtext.mouseEnabled = !event.target.selected;
}
If there's a problem with this approach, I'll be happy to learn that too.
In that case, the following will work instead...
function clickHandler(event:MouseEvent):void {
inputtext.mouseEnabled = !event.target.selected;
}
If there's a problem with this approach, I'll be happy to learn that too.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Advocate
,
/t5/animate-discussions/using-checkbox-to-enable-disable-input-text/m-p/401451#M11612
May 22, 2008
May 22, 2008
Copy link to clipboard
Copied
Kglad is right. You can still enter.
So is it possiple to prevent this?
So is it possiple to prevent this?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/animate-discussions/using-checkbox-to-enable-disable-input-text/m-p/401452#M11613
May 22, 2008
May 22, 2008
Copy link to clipboard
Copied
Since we posted within seconds of each other, you may have
missed my alternative... If kGlad returns, then we'll hopefully see
if his solution (changing it to a dynamic field) is the only safe
solution for some reason.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Advocate
,
/t5/animate-discussions/using-checkbox-to-enable-disable-input-text/m-p/401453#M11614
May 22, 2008
May 22, 2008
Copy link to clipboard
Copied
inputtext.mouseEnabled=false;
seems better solution. Thanks Ned.
seems better solution. Thanks Ned.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
LATEST
/t5/animate-discussions/using-checkbox-to-enable-disable-input-text/m-p/401454#M11615
May 22, 2008
May 22, 2008
Copy link to clipboard
Copied
if you think that's better, you should check if a user can
tab into your textfield.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

