Hey, ... unfortunatly this is the case. Trust me this is a pain in the ass to accept. :)
The theme is the only way to do it with out the graphic getting compiled into the application. This part of Flex still has a ways to go unfortunately. You could also include a simple config file; <?xml version="1.0"?> <flex-config xmlns="http://www.adobe.com/2006/flex-config"> <compiler> <theme> <filename>/swc/FSCollectionFX1A.swc</filename> </theme> </compiler> </flex-config> You could also just include a template css file that comes with your component that the user would just copy into there directory and use. Just depends how packaged you want it. Bottom line is don't waste your time with this. I have already wasted days/weeks thinking about this and here is the simple facts. I come from a Flash component dev background, yes the ExtensionManager was nice but, guess what, there isn't one. Some of the things in Flex dealing with 3rd party components have hurdles associated with them. We have to deal with it and explain to users why this is and it will change in future releases. :) I sell components, my customers don't seem to mind that much. Peace, Mike On 3/6/07, Muzak <[EMAIL PROTECTED]> wrote:
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
-- Teoti Graphix http://www.teotigraphix.com Blog - Flex2Components http://www.flex2components.com You can find more by solving the problem then by 'asking the question'.
