Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-24-2012, 09:16 PM   #1
Registered User
Join Date: Jun 2012
Posts: 8
Default [AS3] UI component "Button"

Hi everyone, I need to realize the UI component "button" with it's own logic, that has methods or properties which allows to change: Number, color, lock-unlock and other. But there is one important detail - if the number that is centralized on the button will be longer than five symbols - the button must expand. Do you know where to find some examples, or may be you can give some advices :-) Thanks!
Hummerr is offline   Reply With Quote
Old 06-24-2012, 10:56 PM   #2
Registered User
Join Date: Jun 2012
Location: USA
Posts: 27
Send a message via Yahoo to CodeVisual

The changes you speak of can be done with the button component as is.

Change color:
var btn:Button = new Button();

var ct:ColorTransform = new ColorTransform();
ct.color = 0x00000;

btn.transform.colorTransform = ct;
btn.enabled = false;
btn.enabled = true;
However, I'm not sure what you mean by changing the "Number" of a button.

To expand the button according to the amount of text you want in it, you can use code similar to this.

var str:String = "This is a lot of text for a button";
btn.label = str;
btn.width += str.length*3;
I'm not saying you shouldn't make a button from scratch, but this approach might be easiest and suit your needs.
CodeVisual is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT. The time now is 07:48 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.