Generic Button Avatar

From Whirled

Jump to: navigation, search
Generic Button Avatar
Image:avatar_icon_sm.png

View in Shop

Screenshot
Image:Generic Button Avatar.png

This article assumes that you are already familiar with creating and compiling Whirled Flex projects. See also simple avatar (ActionScript tutorial).

The source code for a simple circular avatar that displays text, rolls, and can change colors randomly is available here: Image:GenericButtonAvatar.zip. Unzip it into a folder in your whirled directory, where you normally have your Whirled Flex projects.

Edit the Resources.as file to customize the constants, such as what text to display, whether to change color randomly (and if not, what background color to use), the height of the bouncing, the period (time) of the bouncing, etc.

To use a different shape for the avatar, edit the initButton() function of GenericButton.as. If you want your avatar to randomly change colors, you will need this shape to be mostly white, or else all the color transformations will be very dark shades.

If you wish the text to change color randomly instead of the background, edit the transformColor() function of GenericButton.as to transform _words instead of _button, and in Resources.as set the TEXT_COLOR to 0xFFFFFF.

After customization, compile and test the way you normally do your Whirled Flex projects. Windows users may simply double-click build.bat.

Personal tools