13 Replies Latest reply on Jun 1, 2008 7:03 PM by ibolui

    big swf file

    ibolui
      hi, i would like to ask a question regarding flex. this is my first time trying out flex/flash. i have created a simple user profile form using flex as the frontend UI. this form merely consist of some text fields, comboxbox etc. but there are also a few array initialization. below are the codes..

      the form is not yet finish, but the problem i have noticed is that the generated swf is alreay over 500kb. i thought that this is just a simple form with not much effects/animations etc, but already has quite a considerable filesize.

      hence i would like to ask if there is a better way to code the form, or any other problems/solutions that will greatly reduce the swf filesize?

      thanks :)
        • 1. Re: big swf file
          Mitek17 Level 1
          You can't really go below 300-500Kb as this is the Flex framework components sitting in your SWF.

          If you need something very small and quick - use Flash instead.

          With Flex you have to expect that the app size will be at least 300K.

          You should start to worry when you app will reach 1Mb limit, then you can start using other techniques as modules, RSL or just dynamic loading of external SWFs.

          Cheers,
          Dmitri.
          • 2. Re: big swf file
            atta707 Level 2
            How about taking all the arrays out and store them on the server and load them after your application loads to start with.
            • 3. Re: big swf file
              atta707 Level 2
              one more thing: are you reporting size of debug version or release version SWF?

              Relase version SWF should be much smaller than debug version.

              Look into FB help for "Release Builds"
              • 4. Re: big swf file
                ibolui Level 1
                ohh.. i didnt know there are two different types of build. yup the release build is 316kb now. if a flex swf is at least 300kb, i guess is ok then :)

                another thing.. how do i know whether it is a release or debug version from the swf file itself?
                is there any tools to further optimize a swf file :p
                • 5. Re: big swf file
                  Mitek17 Level 1
                  ibolui, did you try to do the Export Release in another directory?
                  Then you can compare the sizes.
                  PS this is for Flex Builder 3

                  Cheers,
                  Dmitri.
                  • 6. Re: big swf file
                    ibolui Level 1
                    yup. i build it using export release in another directory. and the swf is nearly 200kb smaller :)

                    but in general, how do i know whether it is a release or debug version from the swf file itself?
                    is there any tools to further optimize a swf file :p
                    • 7. Re: big swf file
                      Mitek17 Level 1
                      AFAIK there will be no trace() output from the release version.

                      • 8. Re: big swf file
                        ibolui Level 1
                        quote:

                        Originally posted by: atta707
                        How about taking all the arrays out and store them on the server and load them after your application loads to start with.


                        hmmm.. can you show me how this can be done? i am quite new to this :p

                        also, does removing the as codes to a file and making use of import help to reduce the filesize as well? will there be a performance/latency issue?
                        • 9. Re: big swf file
                          atta707 Level 2
                          Look at HTTPService and/or URLLoader classes in the FB help.

                          Yes. I'm sure it will reduce the file size. How much? That depends on the data. Generally speaking you should keep data (especially large one) out of your classes and load it at run time.

                          Of course, user would be notice a small delay on application start up as you send a request to the server to load the data. But then, it's all about trade-offs and experiments is the only way to choose best way.

                          ATTA
                          • 10. Re: big swf file
                            levancho Level 3
                            quote :
                            With Flex you have to expect that the app size will be at least 300K.

                            -------------

                            this is not true at all regarding app swf size, there are many many ways you can make your app extremely small, including, but not limited to fact that you do not need to include whole flex framework if you know what components and their dependants you use, there is py script that does that, also you can use flex framework as a separate swf via rsl pattern and use it as shared resource, etc .... many more ways ....
                            • 11. Re: big swf file
                              Mitek17 Level 1
                              quote:

                              Originally posted by: levancho
                              quote :
                              this is not true at all regarding app swf size, there are many many ways you can make your app extremely small, including, but not limited to fact that you do not need to include whole flex framework if you know what components and their dependants you use, there is py script that does that, also you can use flex framework as a separate swf via rsl pattern and use it as shared resource, etc .... many more ways ....



                              with RSLs it is the same size, just split into a number of files. Addition is commutative function as far as know :)
                              BTW framework_3.0.0.477.swf is 535Kb

                              With the rest - if you don't use flex components - you don't include it. But it leaves you with nothing. The smallest app you can get is <mx:Application /> which is around 70kB.

                              As a most efficient way is to use Flash components, rather than Flex. If size does matter.

                              Cheers,
                              Dmitri.

                              • 12. big swf file
                                levancho Level 3
                                framework_3.0.0.477.swf size 535Kb is not hard limit, you can make it smaller by only compiling necessary components.

                                plus with flex 3 " Persistent Framework Caching" you save more , at the end of the day.
                                point is that initial swf file that needs to be loaded does not have to be 300K as minimum at all.