2 Replies Latest reply on Jul 9, 2007 6:34 PM by

    Application speed

      I'm creating a very user-input intensive application in flex which has a lot of elements visible on the 'stage' at any one given time however, i'm suffering some pretty serious speed issues, such as in my mx-transitions being really choppy.

      So, does anybody have any silver bullets along the lines of speeding up flex applications?
        • 1. Re: Application speed
          I dealt a lot with this problem, as I am actually writing a game in Flex right now. Unfortunately, I can't name any one silver bullet... here are a few thoughts, though...

          Obviously, keep un-needed elements off of the stage. I have a lot of familiarity with runtime optimization from working professionally in the video game industry, so it's easy for me to say this, but really it amounts to conserving variables and logic as much as possible. Think about WHEN something executes - simple tricks like knowing the order in which a compiler executes conditional logic can save you a lot of headache in the long run. Conserve your variables and just really try to think hard about if EVERY piece of data, individually, needs to be loaded at a certain point in time. Conserve the number of times you load images; use the Loader class to load the image (precache) and store the bitmap-data for later use.

          For example, I had a big problem with lag on my map when I first wrote it; since it was tile-based, there was lots of trouble with all the tiles hidden from view and so on. My solution was multi-fold: first I fixed the number of tiles there were, so that there were just enough to cover the screen + a 2 tile buffer around the screen. Tiles which got pushed off the back end of the buffer would move themselves to the front of the buffer (wrapping around) so that new tile objects weren't being deleted/created repeatedly. I did away with the Image class and wrote my own bitmap drawing class, to keep it closer to the base Sprite class and get rid of excess crap. I stored each piece of image data externally and simply copied it into the display object as needed, rather than re-loading the data.

          This, along with other things, has my game running at perfectly smooth speeds now, where once it was barely crawling.
          • 2. Re: Application speed
            Of course.

            I did a crash course in the psychology of web development and have removed a number of un-needed fields/animations from the site that users won't even notice.

            One of the questions I've been meaning to ask though

            I've got a object called "contentCanvas" to which my navigation effects.

            Each navigation button is a custom class with a classname for the components which are loaded to the contentCanvas onclick (after .removeAllChildren of course)

            Do these components sit in the ram or are thye only created when they are added as a child of the canvas,

            Also, is the removed children removed entirely? How do i destory un-needed information in the ram? i want to removeallchildren, but i also want ot destroy the items so they are recompiled if called, rather than just stored.