Original thread (with no replies)
http://tech.groups.yahoo.com/group/flexcomponents/message/1565
Basically, I'm interested in the following:
- custom component (AS3) that extends HBox (or any Container) and by default
has a backgroundImage defined.
- custom Button component (AS3), extends Button, that by default has graphical
skins defined for each button state (up, over, down,
disabled).
- important: don't include graphics if user defines his own.
The graphical assets are in an swf.
Styles are defined through css, e.g.
VideoControl {
/*background image*/
backgroundImage: Embed(source="videocontrol_Assets.swf",
symbol="VideoControlBackground");
}
Getting the above to work in an mxml file is not a problem.
You just include the css file and it automatically picks up the VideoControl
style and applies it to the VideoControl instance.
<mx:Style source="video_control.css" />
<media:VideoControl />
Problem starts when packing it all up to swc.
How does one tie the css to the VideoControl..
Closest think I found so far is described in the "Compiling a theme SWC file"
section of the docs:
http://livedocs.adobe.com/flex/2/docs/00000782.html
and "Using run-time style sheets in custom components"
http://livedocs.macromedia.com/flex/201/html/styles_069_26.html
and at the bottom of that page: Using theme SWC files as run-time style sheets
The theme swc seems out of the question, since then one would always have to
add a compile parameter:
-theme path_to_theme.swc
The runtime swc option seems overly complicated:
<quote>
If you have an existing theme SWC file, you can use it as a run-time style
sheet.
To do this, you must extract the CSS file from the theme SWC file.
You then compile the style SWF file by passing the remaining SWC file as a
library.
</quote>
And one would have to use
StyleManager.loadStyleDeclarations("your_theme_with_css.swf");
Think my biggest hurdle is I want to avoid using (compiling) the default
graphical skins if the user defines his own.
Any suggestions?
regards,
Muzak