Copy link to clipboard
Copied
Dear all,
How do I disable and enable an input textfield?
I have tried these but it returns me with error
1119: Access of possibly undefined property editable through a reference with static type flash.text:TextField.
mc_box.txt_input.editable = false;
mc_box.txt_input.enabled = false;
I have the input textfield inside a movieclip.
I have already imported:
import flash.text.TextField;
1 Correct answer
You can't able to use the enabled property for textbox, another workaround is here:
mc_box.txt_input.type=TextFieldType.DYNAMIC; //to disable the textbox
mc_box.txt_input.type=TextFieldType.INPUT; //to enable the textbox
at runtime
Copy link to clipboard
Copied
You can't able to use the enabled property for textbox, another workaround is here:
mc_box.txt_input.type=TextFieldType.DYNAMIC; //to disable the textbox
mc_box.txt_input.type=TextFieldType.INPUT; //to enable the textbox
at runtime
Copy link to clipboard
Copied
Thanks, relaxatraja
Copy link to clipboard
Copied
You'r Welcome
Copy link to clipboard
Copied
|
I'm trying to make a button toggle this activity.
My code:
btnCapture.addEventListener(MouseEvent.MOUSE_OVER, DisableText);
function DisableText(event:MouseEvent):void
{
sample.textbox1.type=TextFieldType.DYNAMIC; //to disable the textbox
sample.textbox2.type=TextFieldType.DYNAMIC; //to disable the textbox
}
btnCapture.addEventListener(MouseEvent.MOUSE_OUT, EnableText);
function EnableText(event:MouseEvent):void
{
sample.textbox1.type=TextFieldType.INPUT; //to enable the textbox
sample.textbox2.type=TextFieldType.INPUT; //to enable the textbox
}
Any idea why this shouldn't work? Thanks.
Copy link to clipboard
Copied
you might need to import that class:
import flash.text.TextFieldType
if that triggers an error message, your publish settings are incorrect.
Copy link to clipboard
Copied
Try importing the TextFieldType class ( import flash.text.TextFieldType; ).
Running a shortened version of that code in the timeline with objects to match I do not get that error and the code appears to work as planned. Since the error you show indicates a Main.as class file might be involved that might be the difference... class files need to import anything they use.
Copy link to clipboard
Copied
Thanks guys, I wonder why the error reporting doesn't suggest that, how does anyone know what needs to be imported, and how many things are available to import?
How would anyone even know that importing something you've never heard of is the solution?
Thanks again.
Copy link to clipboard
Copied
All good questions Jefferey... it becomes mostly a matter of intuition after you have banged your head against enough walls over time... you should talk to the guys there and see what they can do to alleviate things like this.
I particularly like errors where you are cryptically told there is a problem with loading a file, but no indication of the file name is given... which has to be known by the software and would help solve the issue almost immediately in most cases.
You should also start your own postings instead of piggy backing on someone else's, especially one that has been marked as answered... Not only do you have that working against you, but your name is shared by one of the employees that manages another forum and I ignored it for quite a while figuring it was just being moved from one forum to another by that person.

