Jump to content
Search Community

LoaderMax and loadStyleDeclarations

Livius test
Moderator Tag

Recommended Posts

Hello,

 

I have an AS3 file that loads fonts at runtime from a compiled SWF using:

 

styleManager.loadStyleDeclarations("fonts.swf", true, true);

 

My question is, can I use LoaderMax to load the "fonts.swf" file and use it in the same way I use it with loadStyleDeclaration: being able to force a refresh, so that every element that uses one of the fonts loaded will refresh it's style accordingly.

 

Please let me know if this is something I cn achieve with LoaderMax.

 

Regards,

Livius

Link to comment
Share on other sites

Disclaimer: we're not Flex experts and we try to avoid Flex for the most part because of...well...there are a lot of reasons, but my point is that our focus is on core AS3 concepts. Flex is a very bulky and verbose framework that sits on top but we're not as familiar with its inner workings.

 

There may be some hooks in Flex that would allow this sort of thing, but I'm not aware of any. The loadStyleDeclarations() method appears to be something that manages the loading of an swf itself, so it's not a simple thing where you can just use SWFLoader instead. That being said, I think you certainly could use a SWFLoader to load the swf and report on its progress and then when it's done, just dispose() the SWFLoader and call your loadStyleDeclarations() method because at that point, the file should already be in the cache, thus it'll load almost instantly. This approach allows you to leverage all the goodness of LoaderMax/SWFLoader for the actual loading part, and you still get the benefits/functionality of using the loadStyleDeclarations() method apart from LoaderMax/SWFLoader.

 

Does that help?

  • Like 2
Link to comment
Share on other sites

Hello,

 

Indeed, what you are saying makes a lot of sense. I will do a little test by loading the fonts declarations swf with a SWFLoader component, and then use loadStyleDeclaration method on the same file once the SWFLoader finished it's job.

 

I'll report back the results and most important the loading times of:

SWFLoader + loadStyleDeclarations VS. loadStyleDeclarations only.

 

Thanks again!

Liviu

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...