1 person found this helpful
Are you using the framework RSLs? Even then, it will be hard to beat a 3Kb
Flash SWF. But one you make the SWF complex enough, you'll probably find
that it was faster to develop and maintain the app in Flex than in Flash and
the trade-off will be worth it.
Can you point me to a place to understand what is nessecary to use the RSL's? That might help.
I understand about Flex being easier to work within and that is why we use it. However, our platform is unusual in that it is a private network of legacy devices, some of which are slow. THe load delay is seen as a black screen and not desirable. I really want to use FLex but at least find a way of putting a loader screen up early in the process.
To use the RSLs, see the "framework linkage" option in the Project
Properties in Flash Builder. If you are using ANT scripts, there are
compiler options that have to be set up.
A standard Flex app will show a preloader bar within a second or two unless
the machine is really crippled. However there is a bug where if you use #
on the URL the entire SWF must be downloaded before showing anything.
Some folks will use a small preloader SWF that then loads the main app.
It looks like this might be helpful, but we are using Flex Builder 3 and do not have this option. Is it possible to
load a subset of the application framework in Flex 3 and would that speed up the preinitialization step?
It is in there in FlexBuilder 3. Or you can set up MXML options to do it.
Search the doc or maybe someone who still has FB3 can help.
I really apprecite your help on this. I have tried using RSL and have a few questions. After changing from embedding the framework libraries, two files show up in the build folder:
framework_18.104.22.16858.swf and framework_22.214.171.12458.swz with sizes 556KB and 560 KB repsectively.
The orginal swf I built with embedded framework was 3.5MB and with the RSL's it is 3.2MB.
With RSL's - 4.2MB , with embedding 3.5MB
Why is the total with RSL larger?
In our case, file size is not a huge issue since all swfs are preloaded and run from the hard drive. But since the goal is to reduce startup time, it seems like this is a losing proposition. The flash plaer instance is reloaded each time a swf is launched, so there is no benefit from having cached libraries as far as I can see. Do you agree?
Can you describe what happens before the Application preinitialize event fires?
The main point of RSLs is to gamble on improving download time of the SWF at
networks speeds. The gamble is that someone has already loaded the RSL so
it gets picked up off the browser cache at hard-drive speeds. If it isn't
true, you pay a higher penalty because you are loading an RSL that has code
in it you aren't using. That's why the total payload is more. For the
record, only the SWF or the SWZ gets loaded, not both. But even then the
total payload would be more.
At home, my DSL/WIFI network gets me about 70KB/sec, so saving 300K would be
a noticable savings. If you are loading off a hard disk, 300K probably
won't be felt.
The startup sequence of a SWF over a network (http or https):
-start streaming in SWF bytes
-when the first frame is downloaded (generally about 80-100K) see how many
bytes are left to download and if there is a lot, show a progress bar
-load any RSLs and wait for their download and initialization
-update the progress bar until the rest of the SWF downloads
-after the SWF downloads:
-prepare embedded fonts
-setup managers for popups, tooltips, dragging if needed
-verify and initialize all classes needed by Application
-dispatch Application preinitialize
-instantiate the initial set of children for the Application
-dispatch Application initialize
-update progress bar to show "initializing"
-start validation of Application and its children
-continue to do so until all children are measured and layed out
-dispatch Application creationComplete
-add Application to stage (actually systemManager)
-dispatch Application applicationComplete
The startup sequence of a SWF on a hard drive is different. The entire SWF
must be sucked into memory, unzipped (SWFs are zipped by default) and only
then do we get to the steps where we show a progress bar, check for RSLs,
At 3MB, there might be a noticeable hit. You can find a big image file and
zip it to see if it comes out to about 3MB. Then use the file system to
copy it and see how long that takes and then unzip it and see how long that
Another place that causes delay is in the validation of children. If the
children's size are not stable right away (because data is coming in that
affects their size) then several validation passes might be taking place.
A common error is to create every child in the app, even ones that aren't
seen or needed right away. That adds work at validation time and delays the
I would recommend that you use the performance profiler in Flex Builder to
see where all the time is being spent.
However, 3MB is a big SWF. Use of modules to chop off stuff not needed until
"later" is recommended and will probably be the answer.