Formatting with CSS
You can use CSS code in your action script projects to acheive more advanced effects. So before I look into how to use CSS in action script, we have to note a bit about CSS and it's text formatting abilities. There is a lot of things you can do with CSS but the syntax is really simple.
Changing Colors
All we simply have to do is set the color property. You can use a named color, hexadecimal value or the appropriate rgb values.
Example:
In action script, you are more often going to be formatting links though. You can format links by using a as the selector.Code:span { color: #FF0099; }
Example:
Background ColorsCode:a { color: #FF0099; }
We can change the background colors of elements very easily using the background-color property.
Text DecorationCode:span { background-color: #FF0099; }
There are quite a few things you can do with the text decoration properties. This is often used to remove underlines when you mouse over some text.
Examples:
Text TransformCode:text-decoration: underline; text-decoration: overline; text-decoration: underline overline; /* Text is underlined and overlined. */ text-decoration: blink; text-decoration: line-through;
The text transform properties allow you to control the letters in an element. You can capitalize text, change text to lowercase or change text to uppercase.
Theoretically, you could use this on a text field and it would make sure that the user doesn't enter uppercase letters.
Examples:
Code:text-transform: none; text-transform: lowercase; text-transform: uppercase; text-transform: capitalize;
Text alignment
These are used to control the alignment of text.Code:text-align: center; text-align: right; text-align: left;
Later, we look at different events you can do with CSS using mouseovers and other events. These will allow you greater control over labels in action script. You can use CSS on labels. Since, you can't use text format object on labels this provides you a method to format objects.


LinkBack URL
About LinkBacks





Reply With Quote




+rep




Bookmarks
Algorithms and Data Structures
Java tutorials
Algorithms Forum