The Resource and Styles subsystems use Modules to load at runtime, and
Modules sort of imply a single main class.

 

In the end, the single main class registers various resources and styles
with the appropriate manager, so if you create your own main class and
copy enough code, you can pack all of the styles and resources into a
single module and have it register the right things with the right
managers.  You probably can't use the compiler to generate the single
SWF so you may have to use the generated code and create a custom SWF.

 

It won't tax your brain, but will be tedious.  I'd say it would have a
difficulty rating of 7 out of 10.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Rob Barreca
Sent: Tuesday, May 27, 2008 8:29 PM
To: [email protected]
Subject: [flexcoders] Loading ResourceModule and CSS with one HTTP call

 

When loading a ResourceModule for the Japanese language, we also want to

apply a set of styles to change the default font to something Japanese. 
I have a solution now that loads a ja_JP_Styles.swf through StyleManager

as well as loading a ja_JP_ResourceModule.swf with ResourceManager but 
would like to combine the calls.

1. I know I could forget about loading external style SWFs and put 
something like

StyleManager.getStyleDeclaration("global").setStyle("fontFamily", 
resourceManager.getString("FooBar", "globalFont"));

after setting localeChain, but I'm thinking we'll want to change other 
styles and would like to keep a generic solution like I have now, but 
cut down on the extra HTTP request. Maybe this is my only option?

2. I thought one could somehow Embed("style.css") in my Foo.properties 
ResourceBundle but it doesn't seem like that is the right path.

3. Also, I read in the proposed spec 
(http://opensource.adobe.com/wiki/display/flexsdk/Runtime+Localization+S
pecification#RuntimeLocalizationSpecification-Problem:AstylevalueinaCSSs
electorcan
<http://opensource.adobe.com/wiki/display/flexsdk/Runtime+Localization+S
pecification#RuntimeLocalizationSpecification-Problem:AstylevalueinaCSSs
electorcan> 'tcomefromaresource.) 
that one might be able to do something like the following, but it barfs 
so this feature probably didn't make it in.

global {
fontFamily: Resource(bundle="FooBar", key="globalFont");
}

What is the best way to do this, am I stuck with option #1 if I want to 
just do one HTTP call when switching locales?

Thanks,

-R

 

Reply via email to