Flash: TextField disable an input mode

How can a disabled TextField input mode? Since the property enabled is not available you can use a simple artifice: change runtime state of the TextField. Fortunately, Flash developers are allowed to change the status of a TextField also run through the property type . It follows that if a TextField is added to the Stage as input (and hence type="input" ), by code, we can turn it into a text "static". In reality, the transform them into dynamic text ( type="dynamic" ) but the visual result is the same. The artifice works because both the TextField TextField input the dynamic properties share the same text . So if I put a text in a TextField input when it transformed into a dynamic TextField will have only the impression of not being able to insert characters! That I have disabled the TextField input!

The TextField object may also be extended as a MovieClip, then we may use the following code useful:

1
2
3
prototype . Enabled = function ( v : Boolean ) { TextField . prototype. Enabled = function (v: Boolean ) {
type = v ? "input" : "dynamic" ; this. v type =? "input": "dynamic";
};

One Response to "Flash: TextField disable an input mode"

  1. December 9, 2007 upnews.it :

    undolog  »Blog Archive » Flash: TextField disable an input mode ...

    How can a disabled TextField input mode? Since the enabled property is not available you can use a simple artifice: change runtime state of the TextField ....

Leave a comment

XHTML TAG PERMIT: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> INSERTION CODE:
 <pre></pre> // blocco generico <code></code> // blocco generico [cc_actionscript][/cc_actionscript] // Actionscript [cc_actionscript3][/cc_actionscript3] // Actionscript 3 [cc_css][/cc_css] // CSS Style Sheet [cc_html][/cc_html] // HTML [cc_js][/cc_js] // Javascript [cc_objc][/cc_objc] // Objective-C [cc_php][/cc_objc] // PHP [cc_sql][/cc_sql] // SQL 


Stop SOPA