I was reminded a few weeks ago by Phil Chung (of philterdesign fame) of a bug in the CS3 component framework which we encountered shortly after CS3 was released.
Basically it boils down to setting component-level styles before any components of that type have been created. The styles are created, but when the first component of that type is instantiated, it resets the component styles, and overwrites the changes that were made beforehand. Slap a button in the library of a new FLA, and add the following code:
import fl.controls.Button;
import fl.managers.StyleManager;
var tf:TextFormat = new TextFormat();
tf.color = 0xff0000;
StyleManager.setComponentStyle(Button, "textFormat", tf);
var b:Button = new Button();
addChild(b); |
import fl.controls.Button;
import fl.managers.StyleManager;
var tf:TextFormat = new TextFormat();
tf.color = 0xff0000;
StyleManager.setComponentStyle(Button, "textFormat", tf);
var b:Button = new Button();
addChild(b);
There is an easy workaround, which is to make sure you set component styles *after* a component of that type has been instantiated. You can also just create a dummy instance of the component, and destroy it (which properly creates the style definition) and eliminate the issue.
You can download this fix here. One thing to note is that the components do not compile based on the component source code that is included with CS3, but rather the compiled componentShim component included in each component. To use this updated class, drop it in the appropriate directory (fl/managers) relative to your project, or in any path that is part of your publish class paths. The components will prefer any class definition found locally over the componentShim.
Please note that this is not officially supported by Adobe, and we take no responsibility for its use.
So there you have it. I imagine at some point, an updated release of the components will solve this and other issues, but until then at least this issue is resolved.