Chase Brammer - Using RSL's (Runtime Shared Libraries)


Published on

Advantages of using adobe framework RSL's, creating and using custom/community driven RSL's, differences between Flex Framework RSL's (,, and bugs and problems presented by not using the right Flex Framework RSL.

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Chase Brammer - Using RSL's (Runtime Shared Libraries)

  1. 1. Using RSL’s - Runtime Shared Libraries Chase Brammer
  2. 2. ABOUT ME CURRENTLY Developer at Rain Interactive. Developing for Flex since 2006 Developing for Flash since 2000 Working towards a masters in Information Systems Management at Brigham Young University (BYU) Website: Email: Twitter: chaseb All of my contact information is listed on my business card, come get one (I have a big box I will never go through unless you do)
  3. 3. ABOUT ME
  5. 5. ABOUT RAIN FranklinCovey, NuSkin, Novell, NextPage, HP,, DataMark, MusicRain, Omniture
  6. 6. RAIN What started it all
  7. 7. WHAT YOU WILL SEE IN THE NEXT HOUR If you decide to walk out now, it’s OK. Really. THE GOOD AND BAD OF RSLs TERMS USE CASES Using the Flex Framework as an RSL to speed up load time Creating your own RSL Using an unsigned (non-Adobe) RSL Using an cross-domain unsigned RSL Optimizing your RSL Collaborative work with RSL’s Implementing RSL with a build process (ANT) WHAT YOU WILL NOT SEE IN THE NEXT HOUR Specific details are of the actual Flex Framework itself, stump the presenter with the most outlandish use case you can come up with, or super in depth details of the RSL (This is a 200 level course after all)
  8. 8. THE GOOD AND THE BAD AND THE UGLY BUT REALLY WHY USING RSLs ROCK ADVANTAGES Reduce file size (faster download) Library Caching Code reuse Faster compile time Single Point of Distribution/Update Collaborative and Community Work DISADVANTAGES Cross domain issues (crossdomain.xml) Can't create signed RSL's Debugging Quick editing Must download the whole RSL, doesn’t trim unused classes
  9. 9. THE GOOD AND THE BAD AND THE UGLY BECAUSE SIZE MATTERS Flex with All Framework Components Flex with Button, ComboBox, and TabNavigator Flex with Button Example taken from Ted Patrick’s announcement on RSL’s
  10. 10. THE GOOD AND THE BAD AND THE UGLY BECAUSE SIZE MATTERS Flex with Button Flex with Button, ComboBox, and TabNavigator Flex with All Framework Components Example taken from Ted Patrick’s announcement on RSL’s
  11. 11. TERMS Because jargon is confusing RSL Runtime Shared Library SIGNED RSL Adobe published RSLs (framework, datavis, rpc) UNSIGNED RSL The RSL for the rest of us SWZ An Adobe Signed RSL only for RSLs such as data visualization, Remoting, and the Flex Framework SWC A zip that contains compiled Flash or Flex project that is not a standalone project. Typically a Flex Library project or a collection of assets exported from Flash LIBRARY.SWF One of two files that are included in a SWC that hold the assets of the export (classes, modules, etc...) CATALOGUE.XML The second file in a SWC that holds the structure and relationships of all the assets COMPC The Component Compiler, a command line build utility used to create RSLs BROWSER CACHE Your browsers of choice cache, not to be confused with the Flash Player Cache FLASH CACHE The Flash Player’s internal cache that is used to store signed RSLs ANT Automated command line build utility used to compile flex projects
  12. 12. WHAT IS AN RSL No, it isn’t the soccer team Real Salt Lake PURPOSE Why spent time using an RSL To quickly reduce your application’s file size. Code once, use in many places HOW DOES IT DO THAT? Kung Fu. As in Neo type of Kung Fu. Separates the large core of flex and lets your app go faster (like on Star Trek when they launch their core) If possible loads the RSL from the Flash Cache (signed RSLs only) If possible loads the RSL from the browser cache (unsigned RSLs only) DEVELOPMENT Loads into your project just as if it were a local file, only you can’t edit it
  13. 13. FLEX CORE RSLS Use case #1: How to speed up your application’s load time Use case Your app is big. Too big. You need it smaller and faster. Solution Separate your Flex Framework (or Data Visualization/Remoting) from your compiled swf so that your project loads like greased lightning.
  14. 14. FLEX CORE RSLS How to do it Let me show you.... but just for later reference Right click your project Select Project Properties Select ‘Flex Build Path’ Select the ‘Library Path’ tab Change the Framework linkage to RSL Be sure to add “use-network=false” in your compiler settings to avoid the nasty Error #2148 (Sandbox error)
  15. 15. FLEX CORE RSLS Look at what we did! Wow We just reduced our file size by 500k with 8 clicks (or so) What are those extra files? You will see two extra files in your release directory after you enable the RSL framework_3.3.0.XXXX.swf framework_3.3.0.XXXX.swz These two files are important. In case the end user doesn’t have the framework version you are using cached, then they will download it from you! If these two files aren’t there... you will have some headache.
  16. 16. FLEX CORE RSLS Testing our deployment paths Clear our cache - IMPORTANT The framework RSLs are not stored in the browser cache. They are in fact stored is a secret little place that rarely ever gets seen. The Flash Cache. Only signed RSLs can be included in the flash cache, and if you don’t know about it existence, it will make debugging a living hell for you.
  17. 17. FLEX CORE RSLS Testing and changing our RSL deployment path Testing The best way to test if your RSL’s are loading in right (and not just loading in from your cache) is to clear your flash cache, and then move your local framework files (framework_x.x.xxxx.swf/swz) and see if you get an error. If you get an error great! That means you have something to work with. Move your files back and make sure that everything works now. Changed deployment path Edit the RSL path, via selecting the RSL url and clicking edit
  18. 18. CREATING YOUR OWN RSL Use Case #2 Use Case You have a project that has a core set of components, libraries, or utilities that are pretty much stable and you don’t want to force the users to re-download all of that every time you release a new build. Solution Create a Runtime Shared Library.
  19. 19. CREATING YOUR OWN RSL Creating a Flex Library We could do all that we are going to do by using command line compilers (mxmlc/compc), but lets use the Flex Builder IDE for simplicity Create a project Select files you want to include Thats it! Now, lets look and see how to use your own, unsigned RSL
  20. 20. USING A CUSTOM RSL Use Case #3 Use Case You, a friend, a co-worker, or some dude in India just gave you a SWC, and you want to use it as an RSL Solution Import it it into your project, and make it an RSL
  21. 21. USING A CUSTOM RSL Using your own RSL Add the SWC to your project Copy over your compiled SWC in to your libs folder Right click your project and edit your Library Paths in your project preferences to add your SWC
  22. 22. USING A CUSTOM RSL Making your SWC into an RSL A picture says a thousand words, editing your RSL path
  23. 23. CROSS-DOMAIN RSL Use case #4: Using a Cross-Domain RSL Use case Your company has a common set of components, libraries, or assets that you want to share across multiple projects Solution Create a Cross-Domain RSL
  24. 24. CROSS-DOMAIN RSL Too fast, lets digest some of this TO USE A CROSS-DOMAIN RSL you must have digest enabled DIGEST A SHA-256 hash that acts as a checksum for your RSL. WHAT DOES IT LOOK LIKE? <digests> <digest type=quot;SHA-256quot; signed=quot;falsequot; value=quot;839c300d3805a839f4731a23169b8551d16ec167ad184eb6dad4b9cc58597d79quot; /> </digests> HOW TO ENABLE IT -compute-digest=false <compute-digest>true</compute-digest>
  25. 25. CROSS-DOMAIN RSL Use case #4: Using a Cross-Domain RSL HOW TO INCLUDE A CROSS-DOMAIN RSL 1) Open project properties 2) Select Flex Build Path 3) Select the Library Tab 4) Click “Add a SWC” 5) Add your SWC 6) Open your SWC node 5) Double click on Link Type 6) Change the link type to RSL 7) Change Verification to Digests 8) Make sure your SWF and SWC are uploaded 9) Enter your RSL URL, and Policy File URL
  26. 26. OPTIMIZING YOUR RSL Use case #5: Cutting your RSL in half Use case You just made an RSL and feel pretty good about yourself. But the client wants the app to load even faster. Solution Optimize your RSL by using Optimus Prime! ... er.. the optimizer
  27. 27. OPTIMIZING YOUR RSL Half the size? Why don’t they make RSL’s for people? WHAT IS THE OPTIMIZER It is a tool provided by Adobe to cut out the fat of any file, which is debug information, markup data, and other suspicious characters. WHAT IS THE RESULT In most cases it will reduce the file of your RSL by more than 50% WHERE IS THE OPTIMIZER In your Flex SDK bin directory HOW DO I USE IT like this! optimizer -keep-as3-metadata=quot;Bindable,Managed,ChangeEvent,NonComittingChagneEvent,Transientquot; -input MyRsl.swf -output optimized.swf
  28. 28. COLLABORATING VIA RSLS Use case #6: Collaborative Work WHY WOULD YOU WANT TO DO THAT To be used as a base for work to be expanded upon and shared throughout a community that has a large base, such as: Libraries (SVG) Components ( libraries) Frameworks (Nimbus, Cairngorm, Mate, PureMVC) API’s (Facebook, Twitter) Utilities (AS3 Core Lib, Internal Company Libraries) HOW WOULD IT HELP The more people who it, the more likely it will be that it has already been cached BASE Although RSLs are not the solution for a many user collaborative development of its “self”, it can act as a very powerful, easy, and maintainable base to build on.
  29. 29. AUTOMATED BUILDS AND RSLS Use case #7: Deploying RSLs Use case You need to develop on your Flex Libraries, but what to deploy them as RSLs Solution Use and automated build process (ANT, RAKE, etc) to create your RSLs
  30. 30. AUTOMATED BUILDS AND RSLS Use case #7: Deploying RSLs COMPILE Compile your SWC EXTRACT Extract your SWF for your SWC OPTIMIZE Optimize your SWF MOVE Move your SWF to where you want it (maybe upload it) COMPILE Compile your application page=9
  31. 31. SUMMARY What was all that again? Runtime Shared Library Separates your base (framework, library, components, etc) from your application. The seperated files are then cached for faster loading. When should you use the Framework RSLs? Pretty much always. When should you use your own RSLs When you have a big chunk of code that you don’t want to have to load in every time you make a change to your application All code samples can be downloaded at
  32. 32. CONTACT Get a hold of that one guy WEBSITE EMAIL TWITTER chaseb Seriously, come get my Business card, I have a whole case of em’