14 Replies Latest reply on Oct 29, 2008 2:27 PM by Newsgroup_User

    Flex Application Size Way To Large

    PastaPrimavera Level 1
      I have looked in the help, however I have been unsuccessful in shrinking my final web site.
      I have created a 4 tabbed web page with NO photos, music or any other hog adding feature.
      The only things I have used were from the controls panel, like button, slider and so on.
      In my script section I have this in there so allow some of my controls to work

      import flash.net.XMLSocket;
      import flash.events.*;
      import flash.utils.*;
      import mx.collections.ArrayCollection;

      I am a 3 week old flexer, so I would think that instead of importing *.* I could be more specific and import exactly what it need ?

      The resulting file size is 284k, This is for an embedded application and I need to shrink this file size WAY down.
      A few months ago when I was using Flash, I could do all the same stuff I am doing now and the file size was around 25k.

      Would someone please offer suggestions on what I can do to shrink the final site size down.

      Thanks.



        • 1. Re: Flex Application Size Way To Large
          g-s-b Level 1
          Hi.

          This is a feature of Flex. The smallest Flex file I have made is just under 200k. Try it yourself. What makes it that size is the Flex Framework itself, a must for a Flex example.

          If you can do your app in Flash for some 25K, perhaps Flex is not the correct tool for your job.

          greg.
          • 2. Re: Flex Application Size Way To Large
            rtalton Level 4
            Try going to your project's properties, Flex Build Path, then Library Path, and set the Framework Linkage to "Runtime shared library (RSL)".

            This will greatly reduce the file size. But you will have to deploy the resulting framework files into the same folder as your application. You'll see the two framework files in the bin-release folder. The file names will be something similar to "framework_3.1.0.2710.swf" and "framework_3.1.0.2710.swz".

            Search help for "Framework Linkage " to read more details about what this accomplishes.
            • 3. Flex Application Size Way To Large
              g-s-b Level 1
              That will reduce the size of the application's swf BUT will increase the requires down loads to more files with a combined size larger than the original single swf. This is ok IF you plan to deliver many small swf's to the user but is bad for a one-up usage.


              • 4. Re: Flex Application Size Way To Large
                PastaPrimavera Level 1
                Thanks for the info, The RSL thing wont work for me as I will have to store those files on the system, so I have not accomplished anything doing that. My system only has 1 Meg of storage and the web site is already 280k. When I add the OS to that I am at 720k and I still have more system programming to go.


                Flash may create a smaller file, but Flex is much quicker and friendlier to work with. Not to mention faster to learn.
                What I don't get is how can Adobe make a app like Flash, who's output files size is small doing the same thing, yet Flex output is way greater. Just don't make sense.


                • 5. Re: Flex Application Size Way To Large
                  PastaPrimavera Level 1
                  ok, i tried this, i created a project and the only thing in there is this:

                  <?xml version="1.0" encoding="utf-8"?>
                  <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
                  layout="absolute"
                  backgroundGradientAlphas="[1.0, 1.0]"
                  backgroundGradientColors="[#224281, #5B74A5]">


                  </mx:Application>

                  When i exported the project the .swf file was 152k, now i think that is INSANE that just a bare bones page with nothing on it would be that large.

                  • 6. Re: Flex Application Size Way To Large
                    *gsb*
                    Yes. That is what I was saying above.

                    What you get is the "basic" Flex framework as the starting place for your application. If you do not need the Flex framework, you can use standalone Flash and avoid the framework's overhead. For simple stuff I use a third party swf generator, SWiSHmax. However it is AS2 based instead of Flash CS3 which is AS3 based.

                    • 7. Re: Flex Application Size Way To Large
                      rtalton Level 4
                      @gsb: Using the runtime shared library only requires the user to download the framework file once. For any subsequent visit it will not be downloaded because it is cached on the user's machine. This is a great feature of Flex and pretty much overcomes the difference in the file size between a similar Flash project. There really is no downside.

                      @PastaPrimavera: Most Flex developers would disagree with your comment that 152k is 'insane'. I've done full-featured apps in Flex and obtained very reasonable file sizes (using the RSL) of around 350KB. We're talking about RIAs with an entire web site in one file, not HTML pages being loaded one at a time. I'm not sure what kind of "system" you are using which limits you to only 1MB of storage, but I wouldn't be able to do anything with that unless it was a simple brochure website done in HTML. Sounds like you should be questioning your project's scope and choice of tools, not an arbitrary limit imposed on Flex by a 1MB storage limit.

                      By definition, any RIA website will be larger than what you are demanding. If your target audience does not have broadband and the ability to handle the inherently larger files, don't use Flex. You will only be frustrating yourself for no reason. Wait until you get a project that will let you unleash Flex's potential for creating media-rich web sites. Stick with an HTML editor for now.
                      • 8. Re: Flex Application Size Way To Large
                        Karl_Sigiscar_1971 Level 3

                        Another way of reducing the file size of your application is to use modules.

                        A monolithic application grows larger and larger as you add features to it.

                        A modular application remains slim. You add modules to your applications that bring more features and you load them only when needed.
                        • 9. Re: Flex Application Size Way To Large
                          PastaPrimavera Level 1
                          I agree with most of your comments, as far as my choice of tools goes, what I need to do cannot be done with standard HTML code.
                          I need to create a socket connection to my board to communicate back and forth. I had the the same app I am using not 90% done with FLASH and it was a good 8x smaller file size.

                          I suppose from a web site developers end 200k is not bad for a site.
                          however what I am questioning is why is FLASH able to produce such a small size and FLEX is producing such a large size both doing the same thing ?





                          • 10. Re: Flex Application Size Way To Large
                            rtalton Level 4
                            PastaPrimavera,
                            It is frustrating sometimes!
                            Flex has a larger file size than Flash because it has much more overhead in its framework. But that framework is what enables us to move way beyond Flash in terms of data manipulation. Flex can easily work with data and application servers with its RPC components. Flash can do this, but it is neither as intuitive or as simple IMO.
                            Flex code is compatible with code management systems; Flash code is not.
                            A Flash "application" will not scale like a Flex application will. Working with a timeline is not suited for applications which need to work with lots of different types of changing data. I use After Effects extensively for timeline animation to create Flash video for my Flex applications. but I cannot imagine building a business application within a timeline!
                            So we pay a bit of a price in file size just to get started using Flex with all its components and features, in comparison to Flash. But I think it is better in scenarios where we work with data and need the ability to scale and expand the manipulation of that data. Flex applications are much easier to debug, modify and expand than Flash apps as they really are full-blown applications.
                            And don't forget the ability to turn your Flex app into a desktop app using AIR.
                            Hang in there and pick your development "battles" wisely. Since you obviously have a good grasp on Flash development, you will be able to transfer those skills into Flex and become a killer RIA developer. Don't get frustrated, but try to see the advantages of both worlds and leverage your existing Flash skills into Flex development. Speaking for myself, I wish I had more knowledge of Flash which I could apply to Flex, but Flash has always been rather mysterious to me. So, you have a great advantage here... use it and don't give up on Flex!!!
                            • 11. Re: Flex Application Size Way To Large
                              PastaPrimavera Level 1
                              Thanks, i just got so excited when i started to learn Flash, because it opened up a whole new world for us embedded guys. Think of all the networked stuff you use that could benefit from a nice user interface such as your router, NAS, printer....

                              I suppose like many new Flash programmers it leaves you rolling your eyes on how to do something. No so intuitive... So when a bud of mine told me about Flex, I tried the demo and GOT INSTANTLY HOOKED!!! I love the crap out of it. The only downfall is that the dam file sizes are so friken large compared to Flash that it limits me on the types of microprocessors I can use due to the internal storage, which has to hold the web page & the system code as well.

                              I just figured that since I am new to Flex I must have been doing something wrong and importing more than I needed to.

                              For instance when I define import flash.events.*;
                              To me ".*" Would mean the whole dam thing, all files for events.
                              When lets say I was just using a button. Then I would simply just use: import flash.events.button.
                              I know that is not correct, but I hope it shows my point.
                              So rather than brining in the whole library using ".*" I could be more specific in what I use from the library.








                              • 12. Re: Flex Application Size Way To Large
                                rtalton Level 4
                                You're correct about the import statements. Importing just what you need will reduce the file size. Using: import flash.events.MouseEvent is more efficient than: import flash.events.*

                                Now I understand better what you're trying to do regarding embedding a web page in a hardware device. Never done that. Please share any solutions you come up with!
                                • 13. Re: Flex Application Size Way To Large
                                  PastaPrimavera Level 1
                                  I sure will share, what I have to figure out is what I am using and to only import those. I have no idea where to start looking for that.
                                  • 14. Re: Flex Application Size Way To Large
                                    Level 7

                                    "PastaPrimavera" <webforumsuser@macromedia.com> wrote in message
                                    news:gea656$lmu$1@forums.macromedia.com...
                                    > Thanks, i just got so excited when i started to learn Flash, because it
                                    > opened
                                    > up a whole new world for us embedded guys. Think of all the networked
                                    > stuff you
                                    > use that could benefit from a nice user interface such as your router,
                                    > NAS,
                                    > printer....
                                    >
                                    > I suppose like many new Flash programmers it leaves you rolling your eyes
                                    > on
                                    > how to do something. No so intuitive... So when a bud of mine told me
                                    > about
                                    > Flex, I tried the demo and GOT INSTANTLY HOOKED!!! I love the crap out of
                                    > it.
                                    > The only downfall is that the dam file sizes are so friken large compared
                                    > to
                                    > Flash that it limits me on the types of microprocessors I can use due to
                                    > the
                                    > internal storage, which has to hold the web page & the system code as
                                    > well.
                                    >
                                    > I just figured that since I am new to Flex I must have been doing
                                    > something
                                    > wrong and importing more than I needed to.
                                    >
                                    > For instance when I define import flash.events.*;
                                    > To me ".*" Would mean the whole dam thing, all files for events.
                                    > When lets say I was just using a button. Then I would simply just use:
                                    > import
                                    > flash.events.button.
                                    > I know that is not correct, but I hope it shows my point.
                                    > So rather than brining in the whole library using ".*" I could be more
                                    > specific in what I use from the library.

                                    Everything that is in the same swc with anything you import with it.

                                    HTH;

                                    Amy