This is simpler than it sounds. "Subclass" means the same as "extend."
The easiest way is to create a custom mxml component.  For example the
below subclasses a text input and give is a default text value:

***the custom component***
<?xml version="1.0" encoding="utf-8"?>
<mx:TextInput xmlns:mx="http://www.macromedia.com/2003/mxml";
initialize="initComponent()">
<mx:Script><![CDATA[
        private function initComponent():Void   {
                this.text = "default text"
        }
]]></mx:Script>
</mx:TextInput>

***and the test bed***
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";
xmlns="*">
        <TextInputExtendedSimple />
</mx:Application>

Of course this is trivial, but you get the point.

Tracy



-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of jamiebadman
Sent: Wednesday, June 01, 2005 7:32 AM
To: [email protected]
Subject: [flexcoders] Re: Hiding 'Null'...

--- In [email protected], "alex_harui" <[EMAIL PROTECTED]> wrote:
> The TextInput is kind enough to do a toString() on anything passed 
to 
> its .text property, which is great for Number and other things, but 
> is the root of your problem.
> 
> My advice, subclass TextInput and put the null check on the text 
> setter.
> 
> -Alex

Hi,

At the risk of sounding stupid (well it's painfully obvious to be 
honest ;-) )...

I've scoured for a good example of how to do this subclassing and 
can't find anything. There's an article on the Macromedia site 
called 'A Primer for Building Flex Applications' that seems to 
*almost* help - but the example doesn't go so far as actually 
explaining how the subclass is used/referenced.

Can anyone point me somewhere that contains a good example of 
subclassing that I might be able to learn from ?

Thanks,

Jamie.





 
Yahoo! Groups Links



 






 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to