incubator-flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cortlandt Winters <>
Subject Re: Loading Flex Themes
Date Tue, 30 Oct 2012 13:54:13 GMT
Hi Harbs,

I had to do this with a Flex3 app and I think the same process would work
for you conceptually in Flex4 though modules are different in Flex4 (and
more reliable)

The first part is to use the preinitialize event in your main app to load
your config file or make the server call to get the right theme to load.

The real work is in doing the work of separating your themes into  modules
that you can load dynamically. You need to define an interface that
contains the names of all your graphics, then create concrete classes that
implement the interface by embedding different graphics for your specific

When your preinitialize event returns, you load the correct module for the
theme you'd like to use. Everywhere in your code  you reference the names
of the graphics that are defined in the interface so it works rather

The only annoying thing is that whenever you add a new graphic to your app,
you need to add a version for each theme. For this reason, you might want
to create a "Default" theme class that has a basic, default theme and
subclass it for the themes themselves with their differences. That way
things like icons that are shared amongst all themes are easier to manage
and maintain.



On Tue, Oct 30, 2012 at 3:20 AM, Harbs <> wrote:

> I have a (Flex 4) app in which I need to load different theming based on
> some choice made before the app is loaded at runtime. I know I can set the
> theming using styleManager.loadStyleDeclaration() and specify the correct
> theme using Flashvars, but I'm trying to figure out how to load the correct
> theme initially. I don't want the app to open with one appearance and then
> switch to another. To further complicate matters, I'd like to only load the
> theme that was specified, as the number of themes can become quite large
> and I don't want to load extra assets unnecessarily.
> Ideas?
> Harbs

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message