I am building HTML5 applications at Sencha. It is a great platform, take a look...

 

  Ted Patrick - Developer Relations @ Sencha


   Note: This is the personal blog of Ted Patrick. The opinions and statements voiced here are my own.



Flex 3 Framework Caching

DIGG IT!     Published Monday, January 28, 2008 at 10:50 AM .

One of the new features in Flex 3 and Flash Player (MovieStar) is support for framework caching. Framework caching provides 2 things:

1. Separate the Flex framework from application code via Runtime Shared Libraries (RSL).
2. Installing a secure (signed) Flex framework RSL into Flash Player 9 release 3 (MovieStar)

When you separate the Flex framework into an RSL your application then depends on that RSL and it must be loaded when your app starts up. The RSL contains a specific version of the Flex Framework depending on Flex SDK you use. All sub-versions of Flash Player 9 support RSL but in last release (release 3) Adobe added support for caching a signed (.SWZ) version of the Flex framework. The caching logic installs the signed RSL into the player so that it can be used by Flex app on any domain. This basically allows the RSL to extend the Flash Player so that the Flex Framework version is never downloaded again. The first time a Flex application is used, the caching will occur, the N+1 time the user on any domain will only download the application logic.

Here are two example projects:

Framework cache disabled (default)
Properties/Flex Build Path/Library Path/Framework Linkage/ Merged into code


AC_OETags.js - ( JS Player detection )
playerProductInstall.swf ( Player upgrade SWF )
SampleProject.html ( Base HTML )
SampleProject.swf ( Application SWF file )

Framework cache enabled
Properties/Flex Build Path/Library Path/Framework Linkage/Runtime Shared Library (RSL)


AC_OETags.js - ( JS Player detection )
playerProductInstall.swf ( Player upgrade SWF )
SampleProject.html ( Base HTML )
SampleProject.swf ( Application SWF file )
framework_3.0.189825.swf ( Flex Framework RSL - Loaded for FP9r1 & FP9r2 players )
framework_3.0.189825.swz ( Signed Flex Framework RSL - Loaded for FP9r3+ )

Q: How will this work when a new SDK is released?

The key is that your app is dependent on a specific version of the Flex framework and the caching mechanism supports this. If you run into 2 apps built with different version of the Flex framework, say release and hotfix 1, both frameworks will get cached. This avoids the DLL hell issue typically in deploying windows applications. As the runtime manages caching and supports multiple version of the framework, it just works.

Q: How much smaller?

The signed Flex framework RSL (.SWZ) is 535KB and includes all base components and libraries in Flex. Even if your app uses just a button, the same SDK will get cached. A simple hello world application is 50KB vs the typical 350Kb. Size of your base application will vary depending on the components used as all skinning, style, assets, and custom code will be compiled into this base SWF file.

Q: Does this work with all Flash Players?

YES! Applications where framework caching are turned on will work in all release versions of Flash Player independent of the caching feature. Caching will occur automatically if Flash Player 9 release 3 or higher is installed.

Q: Can I cache custom code in the framework cache?


NO. Only signed Adobe components can be added into the Flex caching feature at this time due to data security. As the cached code is cross-domain enabled, anything in the RSL is added into the security domain of the running application.

Take a deeper look at Flex framework caching it is a great new feature in Flex 3. It will make your applications smaller and they will instantiate faster.

Regards,

Ted :)


Where to find me:

Ted on Twitter - @__ted__
Ted on Adobe Groups
Ted on LinkedIn
Ted on Facebook
Ted at Adobe

Latest

Lists

Links

Jobs

city, state, zip

Archives