Flex 3 - Thursday: Dramatically Smaller Flex SWF F

Flex 3 - Thursday: Dramatically Smaller Flex SWF Files

 

 
What if Flex SWF files could be smaller? (Over 500Kb+ smaller???)
What if a Flex SWF didn't need to embed the Flex Framework?
What if the Flex Framework could cache in the Flash Player?
What if the cached Flex Framework worked across domains?
What if the cached Flex Framework could be updated and versioned?
What if anyone could host the Flex Framework for caching on their domain?


Flex 3 and "FrogStar", codename release of Flash Player 9, adds support for caching the Flex Framework within the Flash Player. This feature is nothing short of a revolution for Flex applications deployed to Flash Player. Moving forward the Flex Framework will be cached within the Flash Player dramatically reducing the size of the output SWF files. Your application SWF files will only contain your code plus the Flex Preloader containing the caching/loading logic and will exclude by majority the Flex Framework. Simply put, the file size cost of using any additional component adds negligible size to your base SWF file.


VISUAL SIMULATION*
*(results may vary, see Matt Chotin for details)


BEFORE PLAYER CACHE:

Flex SWF with Button



Flex SWF with Button,ComboBox,TabNavigator



Flex SWF with All Flex Framework Components





AFTER PLAYER CACHE:


Flex 3 SWF with Button


Flex 3 SWF with Button,ComboBox,TabNavigator


Flex SWF with All Flex Framework Components



Lets dive into some of the details:

Cross-Domain:
The Player Cache allows the Flex Framework to be cached for use across domains. Say the end user visits Yahoo Web Messenger and receives the Flex Framework (Flex 3.0.0 Moxie) for caching. If they then visit Picnik.com or SlideRocket.com or Buzzword or BrightCove.com, and these sites are targeting Flex 3.0.0 Moxie), these sites will reuse the Flex Framework cached within the Flash Player. Because the Framework is cached across domains many sites can receive the benefits of reduced SWF size.

Versionable:
The Player Cache supports Flex 3.0 and future versions of the Flex Framework. Your application can pick which version of the Flex Framework to use and regardless of what changed in Flex moving forward, the legacy version will just work. Each RSL cached within the Flash Player is stored under a unique SHA256 hash based on its unique binary content and signature.

Easy to Use:
The MXMLC/COMPC compilers and Flex Builder 3 makes supporting this functionality easy to use. The Flex Preloader has been enhanced to support the Player Cache features.

Security and Code Signing:
Caching of RSL assets across domains opens many security issues if anyone can cache code in Flash Player. To eliminate this risk code signing was added in Flash Player and assets using this feature must be signed by Adobe. Without this tight security model this feature could never have been added to Flash Player. The upside is that with Flex 3 going Open Source, developers can get new features and components added into the Flex Framework which supports this feature.

Failover and Hosting:
The Flex Framework RSL can be located anywhere even in multiple locations. A site using this Player Cache is not dependent on an Adobe domain or any 3rd party site. The feature includes support for failover URLS so that the Flex Framework SWF can be located in multiple locations cross domains. If downtime on a server occurs, the application will download the Framework RSL from a failover URL.

Cross-Domain RSL:
In parallel with this feature, the Flex Framework now supports Runtime Shared Libraries (RSL's) to be loaded across domains with a Cross-Domain Policy File. Say for example Yahoo wanted to provide an RSL for all Yahoo properties using Flex 3, they could host an RSL that any team could load at runtime to allow code-reuse cross-team and cross-project hosted across Yahoo domains.

Cheers to a more distributed Flex with smaller SWF files and code caching within the Flash Player. It is a great day for Flash and Flex as we can now support a secure distributed component model across domains.

Oh...
One more thing...

This is all 100% optional. If you want deployment to any build of Flash Player 9 version, that remains the default. Over time as "Frogstar" gets wide deployment we will see Flex get smaller and smaller and smaller!

What else is in "FrogStar" you ask? My lips (and blog) are sealed.

I will be covering Apollo features tomorrow. There are new components specific to Apollo and new deployment features as well.

More to come!

Ted :)

ps. Doug, I sure hope this is enough! If not there is still more. :)

Share

0 条评论

留下评论