I've made a custom component and on it I want to place a custom style
named "waxColor".  I started by simply creating getter/setters for
waxColor.  Worked great when I include waxColor="#F0F0F0" to the mxml,
but I want this to be property driven.  So I added

[Style(name="waxColor", format="Color", type="unit", inherit="no")]

to my as file.  I then coded:

override public function setStyle(styleProp:String, newValue:*) : void

override public function styleChanged(styleProp:String) : void

override protected function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number) : void

to do what I needed.  In my component that instantiates my custom
component I do myComp.setStyle("waxColor", 0xF0F0F0) and it works great.

But, the entire reason that I've added this as a style was that I
wanted to control the color via a style sheet.  So in my css file I added

.wax {
waxColor: 0xF0F0F0;
}

and removed the setStyle code.  Now my mxml does not have
waxColor="#F0F0F0" and instead has styleName="wax".  This does not
work.  I have trace statements in all of my overridden functions and
while styleChanged gets triggered, never with styleProp of "waxColor".
 setStyle is never called.

What am I doing wrong?  I really want waxColor to be able to be set
via my css file.

Thanks,
Dale

Reply via email to