Wondering about buttons..

View: New views
3 Messages — Rating Filter:   Alert me  

Wondering about buttons..

by tchredeemed :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have always wondered what the best way to do this was:

I need to create a reusable button, but this button will sometimes have an arrow on the right side, an 'x' on the right side, or nothing on the right side. There might be the possibility to have these on the left side too.

I have attempted this before, but I have never really come up with an elegant solution. Just wondering what the best/cleanest way to do this would be?

Thanks!


Re: Wondering about buttons..

by valdhor-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If I were going to do this, I would create a new class that extended button with a couple of public properties - one to set the icon side and one to set the icon type.



--- In flexcoders@..., "tchredeemed" <apthorp@...> wrote:
>
> I have always wondered what the best way to do this was:
>
> I need to create a reusable button, but this button will sometimes have an arrow on the right side, an 'x' on the right side, or nothing on the right side. There might be the possibility to have these on the left side too.
>
> I have attempted this before, but I have never really come up with an elegant solution. Just wondering what the best/cleanest way to do this would be?
>
> Thanks!
>



Re: Wondering about buttons..

by polestar11 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I would do the same, where these public properties update the style information of the button (icon & labelPlacement)

I would also probably do this as an mxml component (with the code inside a <mx:Script> tag)

--- In flexcoders@..., "valdhor" <valdhorlists@...> wrote:

>
> If I were going to do this, I would create a new class that extended button with a couple of public properties - one to set the icon side and one to set the icon type.
>
>
>
> --- In flexcoders@..., "tchredeemed" <apthorp@> wrote:
> >
> > I have always wondered what the best way to do this was:
> >
> > I need to create a reusable button, but this button will sometimes have an arrow on the right side, an 'x' on the right side, or nothing on the right side. There might be the possibility to have these on the left side too.
> >
> > I have attempted this before, but I have never really come up with an elegant solution. Just wondering what the best/cleanest way to do this would be?
> >
> > Thanks!
> >
>