Actually, make sure you also put a getter in there since Flex requires both getter and setter when you override.

 

function get text() : String

{

  return super.text;

}

 

Matt


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of alex_harui
Sent: Wednesday, June 01, 2005 9:23 AM
To: [email protected]
Subject: [flexcoders] Re: Hiding 'Null'...

 

Actually, a lot of folks have asked this kind of question.  We did a
lot of work to document MXML components which are great ways of
making new components that comprise other components, and we did
document AS Components in several places like Flex Explorer and the
LiveDocs.  However, it still can be hard to get your head around AS
Components because there's way too many use cases to document and the
one you want isn't doc'd.

The essence of what you want to do is this (no guarantees that this
works as is, some fiddling may be required):

JamieTextInput.as
class JamieTextInput extends mx.controls.TextInput
{
  function set text(s)
  {
    if (s == null)
        s = "";
    super.text = s;
  }
}

JamieApp.MXML
<mx:Application xmlns="*" ...>
  <JamieTextInput text={whatever}...>

By extending TextInput you can override the text setter, alter the
input value if necessary then pass it on to the base class

Then you use that class instead of mx:TextInput in your application.





Yahoo! Groups Links

Reply via email to