8 Replies Latest reply on Nov 23, 2010 11:14 PM by Jaikse20

    Flex 4 Performance Issue

    Jaikse20

      Hello everybody,

       

      I test a PoC for an application which contains a lot of components. And when we have to display all components, it takes a very long time.

       

      Here is my PoC

       

      <?xml version="1.0" encoding="utf-8"?>

      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                        xmlns:s="library://ns.adobe.com/flex/spark"

                        xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

           <fx:Declarations>

                <!-- Place non-visual elements (e.g., services, value objects) here -->

           </fx:Declarations>

           

           <fx:Script>

                <![CDATA[

                     import mx.controls.TextInput;

                     

                     public function init():void{

                          

                          //create lot of components

                          var MAX:int = 10000;

                          for(var i:int=0;i<MAX;i++){

                               

                               //create new textInput

                               var textInput:TextInput = new TextInput();

                               panel2.addElement(textInput);

                               

                               

                          }

                          

                     }

                     

                ]]>

           </fx:Script>

           

           <s:Panel id="panel">

                <s:Panel id="panel2">

                     <s:layout>

                          <s:VerticalLayout/>

                     </s:layout>

                </s:Panel>

           </s:Panel>

           <s:Button id="button" label="Create component" click="init()"/>

           

      </s:Application>

       

      When I run this app, it takes 40sec. I Would like to decrease it at 10sec or less.

       

      Do you have any suggestions ?

       

      Thx