custom button

21 views
Skip to first unread message

Nitin Gopi

unread,
Feb 10, 2012, 6:22:46 AM2/10/12
to flex_...@googlegroups.com
Hi
I want to create a custom button component, in which I want the label of the button to be 'Submit' by default. So I created a subclass of button and in the constructor used super.label = 'Submit'. I also read some where that it is better to use getter, setter methods and override them to change some property. Which one is better way?
I also want to know how can I change the cornerRadius of the button in the custom button class? I think that cornerRadius property is not inherited by the subclass, then how can I change it?

With Regards,
Nitin

--
You can only depend on yourself. The cavalry ain't coming.

mahesh blue

unread,
Feb 11, 2012, 5:31:10 AM2/11/12
to flex_...@googlegroups.com
Hi nitin u can implement this by using skinclass
<s:button skinclass= "select createskin from menu it will display the window give the name and click on ok it will give u skinnable button xml

--
You received this message because you are subscribed to the Google Groups "Flex India Community" group.
To post to this group, send email to flex_...@googlegroups.com.
To unsubscribe from this group, send email to flex_india+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/flex_india?hl=en.

Mohit Kumar

unread,
Feb 11, 2012, 5:36:44 AM2/11/12
to flex_...@googlegroups.com
super.label is correct way to do this. As far as setters and getters are concerned,  They are only used if you need to perform some other task while changing the properties.

For corner radius you will have to use setStyle property like:
setStyle("cornerRadius",2);

On Fri, Feb 10, 2012 at 4:52 PM, Nitin Gopi <nitin...@gmail.com> wrote:

--

Akki

unread,
Feb 11, 2012, 10:47:08 PM2/11/12
to Flex India Community
Label Assignment is simple property so you can directly assign that
property. Bindable getter/setter are usefl when you want to perform
something more than assignment.
Corner radius can be set using setStyle but if you want to have some
custom control then you can use updateDisplayList() in skin class of
your button (hope you are using Spark Button) and then control that
property.

But just for label assignment creating a custom button is not a good
idea!!


Thanks,
Akhil Mittal

Nitin Gopi

unread,
Feb 12, 2012, 12:06:34 PM2/12/12
to flex_...@googlegroups.com
Hi All,
Thanks to everybody who replied to my query. 
@Akhil I was reading custom components and experimenting the setter and getter methods, so I tried to use the label property for that. 
Can you give any instance where these setter, getter properties can be usefull. When do we use comitproperties, updatedisplayliste etc. If you can give link to any resource that would be appreciated.
Reply all
Reply to author
Forward
0 new messages