The attached SWF works fine for me.

 

Maybe clean the project and rebuild.  Make sure the SDK version you are
using for both SWFs are the same.  Post the test app SWF if there are
still problems

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of jamal wally
Sent: Wednesday, July 23, 2008 10:24 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Runtime CSS and "SWF is not a loadable module"

 

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
<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
<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