Hi all,
I'm targeting here 2 problems I've been struggling with for quite long
time regarding nested SWFs.

The first, which is more nasty and 5 times more evil is using different
styles for 2 flex applications where one application is loaded into the
shell app.
The behavior I'd like to have is like this:

     1. If the loaded app uses a class selector "greenButton" and the
loader also uses this app, each of the applications would be able to use
the "greenButton" definition it came with.
     2. Same as no. 1 but for type selectors (e.g Alert{...},
Button{...}).
     3. If the loaded app uses some component, whose styles weren't
defined (no class, nor type selctors) it would inherit these styles from
the loader app.

I can settle down without no. 3, but I can/t find anyway to achieve 1 &
2.
To make this question clearer, I made a small app
<http://www.2shared.com/file/3367026/55565dba/StylesTests.html?A>   that
demonstrate the problem I'm refering:

The second issue that gives me hard time is like this:
I use a wrapper swf to load my main flex application. it works just
fine, it's a 1KB swf that does nothing but load a flex application.
However, the flex application is unaware of it being loaded into a
wrapper swf, and since it uses flashvars to know the basic coniguration
to work with (service url and so...), it reads the
Application.application.parameters.
The application.parameters, as you know is simply the
LoaderInfo.parameters copied into the application by thye SystemManager.
What I'd like to do is to inject the application the wrapper swf
flashvars (which is embedded in the html page) just before the
application dispatches the preinitialize event, which is where
client-server communication starts.

I could just load the flex app with query string (app.swf?mode=5), but
that would prevent browser caching, which I'd like to leverage on.
Then, the other options are:
1. Get a hold of the loaded swf root (SystemManager) and set it's
LoaderInfo.parameters to {mode: 5}. that would not work as this is a
read only property...
2. ok,so whay won't you get a reference of that parameters object and
dynamically add some properties to it like that:
var p:Object = loader.content.parameters;
p.mode = 5;
sounds ok, but guess what? every time you access the
loaderInfo.parameters it returns a different copy it, so you end up with
different object every time and can't add new proprties to the soource
object...grrr
3. Ok, so hacking my way there, I thought of changing the
loader.content["application"].parameters, shich is a property copoed
from the SystemManager's loaderinfo.parameters.However, that can be done
only after the SystemManager dispatches an "applicationComplete" event
(because the sys manager just doesn't informs us of any other
events...), which isn't the best time to change the parameters, because
the loaded application can take a hold of them right after the
"preinitialize" event, which is when I always start to fetch
configuration data from the server.

I'd be grateful for any ideas. [:)]

Thanks in advance,

Almog Kurtser.

Reply via email to