tags:

views:

1071

answers:

4

Hi All

I am compiling my css files to swf files and loading them at run time. I have no problem compiling these and using ClassReference statements most of the time:

.miniCashLadderGridStyle
{
    color : #2a2a2a;
    backgroundAlpha : 0;
    borderSkin : ClassReference("mx.skins.ProgrammaticSkin");
    headerSortSeparatorSkin : ClassReference("mx.skins.ProgrammaticSkin");
    horizontalSeparatorSkin : ClassReference("company.assets.GridHorzDivLine");
    verticalSeparatorSkin : ClassReference("company.assets.GridVertDivLine");
}

That works fine. The assets come from a seperate swc, However this:

header-background-skin : ClassReference("company.view.grid.skin.HeaderBackground");

Does not work. The difference is that the HeaderBackground is a class in the same project as the css file. That does compiel fine if I move the style into my mxml file though.

I wonder if the compiler uses different source paths when compiling the css fiels or something.

This is in FlashBuilder 4 build 269271 SDK 13963

A: 

This may help:

Flex supports external CSS style sheets. To apply a style sheet to the current document and its child documents, use the source property of the tag. External style sheet files should be in the folder that contains your MXML source files. By default, this is the src folder in your MXML project.

Note: You should try to limit the number of style sheets used in an application, and set the style sheet only at the top-level document in the application (the document that contains the tag). If you set a style sheet in a child document, unexpected results can occur.

The following example defines two CSS class selectors in an external CSS file called external.css. You use an external CSS file in a Flex application by specifying its path and file name in the source property of the tag. Example: External CSS file

/* An external CSS file */
.solidBorder
{
    borderStyle: "solid";
}

.solidBorderPaddedVertically
{
    borderStyle: "solid";
    paddingTop: 12px;
    paddingBottom: 12px;
}

MXML file

<?xml version="1.0" encoding="utf-8"?>
<mx:Application 
    xmlns:mx="http://www.adobe.com/2006/mxml" 
    width="150" height="140" 
    viewSourceURL="src/StylesExternal/index.html"

>
    <mx:Style source="styles/external.css" />

    <mx:VBox styleName="solidBorder">

        <mx:Button label="Submit"/>
    </mx:VBox>

    <mx:VBox styleName="solidBorderPaddedVertically">
        <mx:Button label="Submit"/>
    </mx:VBox>

</mx:Application>
Todd Moses
That would probably work but that would compile the styles into the swf. We compile css files into their own swf file and load them at run time. It is compiling this style module that causes the issues.
Roaders
A: 

No buddy,

his question was, he gives a classreference from a css file, which is made to "compile to swf" ie for runtime applying themes,

now css that is now being swf has classreference to a actionscript programmic skin

which is not able to fetch

can any 1 solve it?

kiran
A: 

The problem is that when you compile css to swf in Flex/Flash builder, it runs mxmlc without the project's build path, so the sources are not visible to the compiler. The old bug filed 2 years ago

The workaround is to place the packages needed to the same folder where the css is (even a symlink is enough). The compiler would see the files & compile them to classes appropriately.

A: 

When compiling the CSS, provide the swf of the module in the library-path parameter of the compiler and he'll see the class.

nhu