Az Expattech az ünnepek alatt (dec.24-jan.1.) zárva tart. Nyitás: 2024.január 2

ExpatTech Techblog

Peter Todd 2010.09.23. 11:59

Flash Cookbook - CSS - Use CSS to design flash

In this section we will see how to use css files to design our flash content. We will use css as a file to parse, with the built-in css parser. Even though flash htmltext knows only a part of the css styles and stuff, it won't bother us, as we will use it to dynamically style our movieclips.

Therefore in this example the goal is to create a box, with a certain location, dimensions and backgroundcolor (fillcolor).

Let's say we already loaded and parsed our css file (read about this in another post, you will).

So here we are, we just need to request for the properties of a css class.

.box
{
    color: #00ff00;
    top: 25px;
    right: 25px;
    width: 120px;
    height: 100px;
}

Above the css part can be seen. It wouldn't really matter what words you use, just use the normal css syntax.

And there we are, we parse this css, analyse it (take away "px" from the data, transform color value (#00ff00 to 0x00ff00) and done.