PDA

View Full Version : Set Custom Comp styles from Embedded CSS


arkum
10-01-2008, 07:55 PM
Hello,

I have a custom component that declares a skin style:

[Style(name="playButtonUpIcon", type="Class", inherit="no")]

I can set these no problem from within an instance's MXML tags using an embedded swf:

[Embed(source="assets/swf/skins.swf", symbol="TimelinePlayButton_up_icon")]
[Bindable]
private var upIcon:Class;

<app:MyClass styleName="timeline" playButtonUpIcon="{upIcon}" />

However, if I try and set this style from an Embedded CSS file, it doesn't work.

.timeline{
playButtonUpIcon: Embed(source="assets/swf/skins.swf#TimelinePlayButton_up_icon");

}

I know the swf is embedded ok because I am pullling other skins from it within the same css file.

Where could the problem lie?

dr_zeus
10-02-2008, 07:54 PM
You should post the error message you get when it doesn't work in the CSS file.

arkum
10-03-2008, 10:24 AM
Hi,

I get no error at all from the css, but the property is never set. A trace in the comp's setStyle(styleProp:String) shows Flex doesn't set the prop.

I know this is very strange. I have tripple checked my styleName matches the right comp and all the usual. Have had to resort to setting the styles in the mxml.

dr_zeus
10-06-2008, 07:44 PM
It shouldn't matter, but try this instead:

playButtonUpIcon: Embed(source="assets/swf/skins.swf" symbol="TimelinePlayButton_up_icon");