Although I do get a runtime error when the application tries to load the style 
SWF that I 
made via "mxmlc BasicStyle.css"  (the SWF in the assets/ folder), I was finally 
able to get 
styles to successfully load using the SWF generated by FB3.

I'd still like to know how to load style SWFs made via mxmlc though.

In the meantime, here's how I got the styles to load:

* In FB 3, I right-clicked (CTRL-Clicked on a mac) on the assets/BasicStyle.css 
file and 
selected "Compile CSS to SWF".  This put a check mark next to that option.
* Then I noticed that FB3 compiled the CSS file into a SWF and located that swf 
in:
bin/Users/<username>/Documents/Flex Builder 
3/testRuntimeCss/assets/BasicStyles.swf
   notice that FB3 reproduced the directory structure of the Flex Project 
location under the 
bin directory (rather than putting the style SWF in the assets/ folder 
directly).

* So I updated my MXML file to read:
StyleManager.loadStyleDeclarations("Users/jbattat/Documents/Flex Builder 
3/testRuntimeCss/assets/BasicStyles.swf")
  (the path passed to loadStyleDeclarations() used to be 
../assets/BasicStyles.swf)

* Then I did a debug run, clicked the Button and the styles were successfully 
loaded.

So some obvious questions remain:
* Do you really have to code the path to the style swf in this way, or can you 
tell
  FB3 to compile the CSS file into a SWF and place the SWF directly in the 
bin-debug/ 
folder (or elsewhere)
* How do you get runtime styles to load using style SWFs made via mxmlc (this 
is the 
critical question for me).
* Is there a way to "diff" two SWFs?  I have one SWF (made by FB3) that works 
and one 
(made by mxmlc) that does not.  Seeing the differences between the two would be 
instructive.

As always, thanks for your help
 -- j


--- In flexcoders@yahoogroups.com, jamal wally <[EMAIL PROTECTED]> wrote:
>
> Hello again,
> 
> OK, I'm sending the style swf as an attachment to this post.  If it doesn't 
> work, I will 
email directly to you Alex (thank you very much for your patience).  
> 
> Alex, to answer your question about the location of the style swf:  The style 
> SWF is local 
to my machine and lives in a subdirectory of the project.  
> 
> I named the flex project testRuntimeCss and the project files are in:
>   ~/Documents/Flex Builder 3/testRuntimeCss/
> The main MXML file is in the default location (src/) and the style CSS and 
> SWF files are 
both in assets/.
> 
> Let me also point out that in order to minimize the potential for user-error 
> on my part, 
I have re-done my test runtime css Flex Project so that it follows the Adobe 
example at:
>   http://livedocs.adobe.com/flex/3/html/help.html?content=styles_10.html
> 
> I copied/pasted their example simple CSS into a file called BasicStyles.css 
> which lives in 
the assets/ folder of my project.  For completeness, here is the content of the 
CSS file, 
copied directly from the Adobe help page listed above.
> 
> /* styles/runtime/assets/BasicStyles.css */
> Button {
>     fontSize:    24;
>     color: #FF9933;
> }
> 
> Label {
>     fontSize:    24;
>     color: #FF9933;
> }
> 
> I then compiled the CSS file into a SWF with:
>  > mxmlc BasicStyle.css
> 
> The resulting swf, BasicStyle.swf, is attached.
> 
> By the way, I am using the mxmlc app from SDK 3.0.0 (on Mac Leopard)
>  > which mxmlc
> /Applications/Adobe Flex Builder 3/sdks/3.0.0/bin/mxmlc
> 
> Another thing to point out is that I have done this both with "Compile CSS to 
> SWF" option 
for the BasicStyle.css file on and off.  Both approaches give the same result 
(runtime error 
-- described below).
> 
> I then copied/pasted the MXML content from the Adobe help page into my main 
> MXML 
file.  Again, for completeness, here is the MXML that I used:
> 
> <?xml version="1.0"?>
> <!-- styles/BasicApp.mxml -->
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>
>     <mx:Script>
>         <![CDATA[
>         import mx.styles.StyleManager;
>         
>         public function applyRuntimeStyleSheet():void {
>             StyleManager.loadStyleDeclarations("../assets/BasicStyles.swf")
>         }
>         ]]>
>     </mx:Script>    
>     <mx:Label text="Click the button to load a new CSS-based SWF file"/>
>     <mx:Button id="b1" label="Click Me" click="applyRuntimeStyleSheet()"/>
> </mx:Application>
>  
> 
> When I debug in FB3, the application SWF successfully loads in my web 
> browser. But 
when I click on the button labeled "Click Me", the application crashes.  The 
error I get is:
> 
>   Error: Unable to load style(SWF is not a loadable module):
>   ../assets/BasicStyles.swf.
> 
> Just before that error, I get the following trace which suggests that the SWF 
> style file 
was, indeed found.
> 
>  [SWF] Users:jbattat:Documents:Flex Builder  
> 3:testRuntimeCss:assets:BasicStyles.swf - 
34,571 bytes after decompression
> 
> Please let me know if you find a problem with the attached swf. 
> 
> -- j
>



Reply via email to