View unanswered posts | View active topics



Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Using caching for the Flex framework: The easy way! 
Author Message
Member

Joined: Wed Aug 01, 2007 3:37 pm
Posts: 1223
Location: Grizzly Flats, CA
Reply with quote
Hi everyone,

I'm going to show you the easy way to use the signed Flex framework RSL; letting you cache all that heavy Flex code to lighten up your apps.


Here's what you do:

1. Go to FlashDevelop and open a Flex project
2. Under Project > Properties, select "Compiler Options"
3. Select "Advanced Compiler Options" and click the ellipses ("...")
4. Type in this option: -static-rsls=false
5. Open the "framworks\rsls" directory located where you installed the Adobe Flex 3 SDK
6. Copy "framework_3.2.0.3958.swf" and "framework_3.2.0.3958.swz" to your project directory*
7. Compile your project. You're done!

* The swz file is required for properly caching the Flex framework and is usually only available for major versions of the Flex SDK. If this file is not present, try downloading the most recent milestone release.


So why do I want to use it?

Flex applications using the signed RSL will be around 100 to 525 KB smaller, depending on what classes you already use. Applications will benefit from users have downloaded the RSL from another domain, or from other applications on your site.


What does Flash Player support look like?

Caching is enabled since 9.0.0.115, so that's where you'll see the best results. Adobe reported that 61.8% of internet users were using Flash Player 9.0.0.115 in March. Visitors from older players will still see the application correctly but will only use the browser's cache


Does it make sense to use it?

Yes! If want to support current builds or use multiple Flex apps then this is for you. Since the RSL is backwards-compatible, your application will still work with older players. Best use right now is on a case-by-case basis.

I used the signed RSL and saw a decrease of 380 KB in my latest project. Older players will need to download an additional 150 KB when they first use the application, but the benefits outweigh the cost to me.


I hope this helps someone! More information regarding Flex 3 RSLs can be found in this article:

http://labs.adobe.com/wiki/index.php/Fl ... _as_an_RSL


UPDATE:

Adobe just updated their Flash penetration statistics for June. Apparantly Flash Player 9 penetration is up 0.5% and version 9.0.115 is up 19.9%. This means that users who can take advantage of Flex framework caching are now up to 81.7%.


UPDATE 2:

Flex has a bug which causes Modules to fail to load correctly when all of them are using the signed RSL and they are loaded simultaneously. Although this is unfortunate, there is a workaround. Currently you must wait until each Module has dispatched a "ready" event before beginning to load the next Module. Adobe has promised to fix this issue in Flex 4 but currently (08-19-2008) they have not addressed this issue yet in their nightly builds.


Last edited by elyon on Tue Feb 24, 2009 5:24 pm, edited 5 times in total.



Mon Jul 07, 2008 10:59 pm
Profile WWW
Member

Joined: Tue Jul 08, 2008 11:20 am
Posts: 5
Reply with quote
why when i did it: http://www.flashdevelop.org/community/v ... hlight=rsl firefox no longer load page properly ? screen is blank and only when i right clik mouse button and clik on play - page is loading normally, but in ie and safari it works ok, only firefox not load page automatically, if i have everything in one file, big swf than it works goog, but when it is in separates swf or like in this sticky rsl to reduce size - it is wrong, why ?


Tue Jul 08, 2008 11:23 am
Profile
Member

Joined: Wed Aug 01, 2007 3:37 pm
Posts: 1223
Location: Grizzly Flats, CA
Reply with quote
Post 
Hi matx,

Could you please tell me what version of Firefox you are using? I would like to be able to look into your problem.

It would be helpful if you could provide:

1. Your current operating system
2. The version of Firefox you have installed
3. The version of Flash Player installed in Firefox

You should be able to determine your version of Firefox by going to "Help" or "About". Similarly you can find your version of Flash Player by right-clicking on Flash content in the browser and selecting "About"


Tue Jul 08, 2008 8:20 pm
Profile WWW
Member

Joined: Tue Jul 08, 2008 11:20 am
Posts: 5
Reply with quote
Post 
i tested it on firefox 2.0 and firefox 3, windows xp, in home computer, in work, in vmware workstation, everywhere the same, but - everytime if swf is loading some other swf.... if everything is in one file - its ok, page loaded, than played automatically, but when something is in two files or more (even if one file is only swfloader which loads another swf) - i see this green-gray screen and have to click right mouse menu on forward or play to see my flash content. i tested it on 9,0,115,0 and 9.0.124.0


on ie 6 , 7, safari - it is OK


Wed Jul 09, 2008 5:21 am
Profile
Member

Joined: Wed Aug 01, 2007 3:37 pm
Posts: 1223
Location: Grizzly Flats, CA
Reply with quote
Post 
Hi matx,

I came across a discussion yesterday where someone had this same issue. The details of their conversation can be found here:

http://tech.groups.yahoo.com/group/flex ... sage/96781

He referenced an issue he posted on Adobe's bug tracking system, so I looked it up. That issue is posted here:

http://bugs.adobe.com/jira/browse/SDK-14085

The issue is marked as "closed", but there don't appear to be any solutions or mentions of fixes made, which is unfortunate.

However, it looks possible to build your child SWFs as "modules". I think this may solve the problem. I found some example source code for this style of application:

http://www.brucephillips.name/flex/modu ... index.html

As far as I can tell, to use this style of application you need to compile only your parent application to use the Flex RSL, then you need to base your child SWFs on the class mx:Module instead of mx:Application. Then in the example he used mx:ModuleLoader instead of mx:SWFLoader or some other loading class.

By using this approach, perhaps Flex will only request the framework once and work. If you try this out, please let us know how it goes -- I for one would be interested to hear the results


Wed Jul 09, 2008 6:48 pm
Profile WWW
Member

Joined: Tue Jul 08, 2008 11:20 am
Posts: 5
Reply with quote
Post 
thanks.... but what is strange here is that this is only only in one browser - firefox.


Thu Jul 10, 2008 5:05 am
Profile
Member

Joined: Wed Aug 01, 2007 3:37 pm
Posts: 1223
Location: Grizzly Flats, CA
Reply with quote
Post 
I just posted a pair of simple applications to give this a try. It may be a little too simplistic to truly troubleshoot the problem, but it should be helpful for reference nevertheless.


Application

http://www.joshuagranick.com/testing/rs ... plication/

Module

http://www.joshuagranick.com/testing/rsltest/module/

Source files

http://www.joshuagranick.com/testing/rs ... 07-11-2008).zip
http://www.joshuagranick.com/testing/rs ... 07-11-2008).zip


I did discover when I was testing that I was incorrect about what I said earlier about using modules. You would want to include -static-rsls=false in both the parent application and the module. Even though both examples make use of RSLs, I've included both here in case they produce different results in your browser.

I gave these a try in Firefox and they both worked for me.

Would you mind testing these links and seeing if you get different results?


Fri Jul 11, 2008 5:13 pm
Profile WWW
Member

Joined: Tue Jul 08, 2008 11:20 am
Posts: 5
Reply with quote
Post 
your examples works fine, but i posted PM to you, elyon


Sun Jul 13, 2008 5:04 am
Profile
Member

Joined: Wed Aug 01, 2007 3:37 pm
Posts: 1223
Location: Grizzly Flats, CA
Reply with quote
Post 
matx and I worked out the issue over private messages. The issue he saw was probably rare and unusual, but if you ever see the same problem I would advise that you try publishing as "debug" instead of "release" -- for whatever reason, changing that made it work on his system.


Thu Jul 17, 2008 7:25 pm
Profile WWW
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
Future feature proposal:

What do you think about adding in FD projects a "use framework caching" option which would automatically copy the SWC/SWZ near the published SWF?

Would it be safe & useful?

The option could even be enabled by default in Flex 3 projects.


Sun Mar 15, 2009 7:56 pm
Profile WWW
Member

Joined: Wed Aug 01, 2007 3:37 pm
Posts: 1223
Location: Grizzly Flats, CA
Reply with quote
Most users have a Flash player version which supports framework caching. I think it makes sense to include framework caching in the default project, but it will not function properly if a developer is not using a milestone release of Flex -- that is the only catch I can think of.


Tue Mar 17, 2009 8:18 am
Profile WWW
Member

Joined: Wed Aug 01, 2007 3:37 pm
Posts: 1223
Location: Grizzly Flats, CA
Reply with quote
Then again, is the Flex SDK distributable? Perhaps there would be some market for an all-in-one FlashDevelop install


Tue Mar 17, 2009 9:03 am
Profile WWW
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
elyon wrote:
Then again, is the Flex SDK distributable? Perhaps there would be some market for an all-in-one FlashDevelop install

We are thinking about that - the SDK seems to be redistribuable.


Tue Mar 17, 2009 5:51 pm
Profile WWW
Member

Joined: Tue Mar 11, 2008 7:07 pm
Posts: 41
Reply with quote
AXDT uses Opensource FlexSDK (3 and 4)


Wed Mar 18, 2009 2:03 pm
Profile
Member

Joined: Tue May 22, 2007 10:40 pm
Posts: 13
Reply with quote
A 'use framework caching' option would be nice, I think almost everybody writing flex apps now should be using framework caching. The other big flex feature I'm missing is module support (and automatically adding the compiler flags to optimize the modules).

thanks!


Fri May 15, 2009 6:54 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 20 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.