Thank you for your reply, Alex.  I tried doing the following with the
SWFLoader:

   var lctx: LoaderContext = new LoaderContext();
   lctx.applicationDomain = ApplicationDomain.currentDomain;
   loader.loaderContext = lctx;
   loader.load("MyApp.swf");

However, when MyApp loads a runtime CSS SWF, its styles are still not
updating.  Both the loading SWF and the MyApp SWF are local files in the
same directory.

I poked around in the StyleManager code and saw that it calls the
styleDeclarationsChanged() method after a CSS SWF has been loaded.  It looks
like this:

public function styleDeclarationsChanged():void
{
  var sms:Array /* of SystemManager */ =
        SystemManagerGlobals.topLevelSystemManagers;
  var n:int = sms.length;
  for (var i:int = 0; i < n; i++)
  {
        var sm:SystemManager = SystemManager(sms[i]);
        sm.regenerateStyleCache(true);
        sm.notifyStyleChangeInChildren(null, true);
  }
}

When I stepped through this, I saw that the sms array contains only the
SystemManager for the main application.  So I decided to have MyApp
explicitly update its own SystemManager after a CSS SWF is loaded:

   systemManager.mx_internal::regenerateStyleCache(true);
   systemManager.mx_internal::notifyStyleChangeInChildren (null, true);

This actually got all the styles to update on-screen.  So what's not working
right here?  Is it related to the application domain or is it something
else?


On 9/29/07, Alex Harui <[EMAIL PROTECTED]> wrote:
>
>    That's a common tripping point with runtime  CSS.  In a subswf config,
> you have to specify the applicationDomain parameter to be
> ApplicationDomain.currentDomain.  If you care why, see my modules
> presentation on my blog (blogs.adobe.com/aharui)
>
>
>  ------------------------------
>
> *From:* [email protected] [mailto:[EMAIL PROTECTED] *On
> Behalf Of *Jason Y. Kwong
> *Sent:* Saturday, September 29, 2007 1:05 PM
> *To:* [email protected]
> *Subject:* [flexcoders] Runtime CSS problem with SWFLoader
>
>
>
> I've got an app which loads different runtime CSS SWFs to change its
> appearance at runtime.  Everything works fine.  However, if I load this app
> inside another app using SWFLoader, the style changes don't happen.  At
> best, some of the new styles are applied, but never all.  I can confirm that
> the CSS SWF is indeed being loaded (I get info in the console about it),
> it's just that the new styles are not applied.  Is this a bug?  I'm using
> Flex Builder 2.01.
>
>  
>

Reply via email to