heh, that's almost the exact description of what I called the
"CanvasButton":
http://dougmccune.com/blog/2007/06/01/new-component-canvasbutton-added-to-flexlib/

Doug

On Thu, Sep 11, 2008 at 3:22 PM, Josh McDonald <[EMAIL PROTECTED]> wrote:

>   Yeah, I'd make one subclass of Button that lets you put whatever you
> please as the label, and have "function set labelControl(cntrl:*)" as the
> [DefaultProperty]. If it finds a string, go with a UITextField, if it's a
> DisplayObject, use it, if not throw an error. Then you have:
>
> <pkg:FreeFormButton click="doStuff" width="150">
>   <mx:text>blah blah blah blah blah blah blah blah blah</mx:text>
> </pkg:FreeFormButton>
>
> -Josh
>
>
> On Fri, Sep 12, 2008 at 8:04 AM, Alex Harui <[EMAIL PROTECTED]> wrote:
>
>>  Make one subclass that handles both HTML and multiline?
>>
>>
>>
>> *From:* [email protected] [mailto:[EMAIL PROTECTED] *On
>> Behalf Of *wnoone01
>> *Sent:* Thursday, September 11, 2008 11:17 AM
>> *To:* [email protected]
>> *Subject:* [flexcoders] Subclassing Components: Theoretical Question
>>
>>
>>
>> Hey all,
>> I've got a theoretical question about subclassing a component. Here is
>> the use case:
>>
>> A programmer requires buttons that support multiline labels. This is a
>> requiement for Button, RadioButton, and CheckBox. Now to start, the
>> programmer can subclass mx.controls.Button to implement the
>> functionality. But now he needs to implement the functionality in
>> RadioButton and CheckBox.
>>
>> One way is to subclass RadioButton and CheckBox and then duplicate the
>> functionality there. However, not only will he be duplicating
>> functionality, he is headed down a slippery slope. Let's say that for
>> his next project, he suddenly requires a button label that supports
>> HTML formatting. Now he must subclass again. So now the classes grow
>> from:
>>
>> MultilineButton
>> MultilineRadioButton
>> MultilineCheckBox
>>
>> To
>>
>> MultilineButton
>> HTMLButton
>> MultilineRadioButton
>> HTMLRadioButton
>> MultilineCheckBox
>> HTMLCheckBox
>>
>> The next project requires a multiline html button. So now its:
>>
>> MultilineButton
>> HTMLButton
>> MultilineHTMLButton
>> MultilineRadioButton
>> HTMLRadioButton
>> MultilineHTMLRadioButton
>> MultilineCheckBox
>> HTMLCheckBox
>> MultilineHTMLCheckBox
>>
>> And now its officially out of hand and the programmer is mired in a
>> subclassing nightmare.
>>
>> ---
>>
>> So basically my question is what is the best way to handle this
>> problem in Flex. Is subclassing the only way or is there a more
>> efficient solution (decorators, item renderers, etc.)?
>>
>> Thanks in advance for any guidance
>> Bill
>>
>>
>
>
> --
> "Therefore, send not to know For whom the bell tolls. It tolls for thee."
>
> http://flex.joshmcdonald.info/
>
> :: Josh 'G-Funk' McDonald
> :: 0437 221 380 :: [EMAIL PROTECTED]
>  
>

Reply via email to