Skip navigation
Currently Being Moderated

Use css variables in css stylesheet file

Apr 2, 2010 8:22 PM

Anybody know if is posibble use variables inside the ccs file for Flex application.


Example: I have a declaration like:

global{baseColor = "#999999"}


I need use this color in many other declaration. I know this is posibble in css for html, example:


@server variable myColor = #3333333



color = myColor



I have a css file with a lot of declaration and it grow time by time, is very hard write the same color many times.


Any help???

  • Currently Being Moderated
    Apr 7, 2010 5:05 PM   in reply to fisad

    There is no way to define variables inside a css file. This seems to be a top request by web developers, and there is also an article here about why css should NOT support variables. I am including links that talk about the issue.
    The links also talk about how to define the same color for multiple selectors. -for-use-within-that-css-file


    Hope that helps!

    Mark as:
  • Currently Being Moderated
    Apr 9, 2010 9:09 AM   in reply to fisad

    The link below has an example of how to create a custom skin property and pass a value to a custom skin property. It might help with some of the exclusions that you are trying to define.


    Mark as:
  • Currently Being Moderated
    Feb 23, 2011 8:41 AM   in reply to fisad

    I know this thread is old but this might help others:


        private var myColour:int = 0x000000;

        @namespace s "library://";
        s|Button {
            color: PropertyReference("myColour");

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points