views:

210

answers:

2

I did the following code. I know it's horribly written, but it's only a box with two combo boxes and a textinput bellow being added to a VBox, whose id is "garage". The problem, is that, however I do it, when I open the combo box the program slows down so much it's unbearable to use it any longer. I'd like to know if you have any idea on what's behind the ComboBox and the possible causes for this "slowing down" when I open the ComboBox... Perhaps the rendering or something? Anything to try or to look for will be we welcome thanks.

<mx:VBox width="100%" height="100%" id="garage" initialize="garage.addChild(User.instance.house.garage);" >
            <mx:Label text="Garagem" />
            <mx:Button label="Adicionar automóvel"
                click="var c:VBox = new VBox();
                var h:HBox = new HBox(); 
                var cb1:ComboBox = new ComboBox();
                cb1.dataProvider=new ArrayCollection(['Compacto','Familiar','Carrinha']);
                h.addChild(cb1);
                cb1 = new ComboBox();
                cb1.dataProvider=new ArrayCollection(['Compacto','Familiar','Carrinha']);
                h.addChild(cb1);
                c.addChild(h); c.addChild(new TextInput()); garage.addChild(c);"/>
</mx:VBox>
A: 

Everytime you press click, a buch of new things are created. I tend to extend a component, and have all those items like your ArrayCollections ready to be initialized when you create the (extended) Button.

joyceschan
A: 

As the comment to my question suggested, the problem is not the piece of code I shown. I didn't really think it was, I just wanted to know what kind of things I should look up for. What happened is that I had a lot of screens with a lot of components piled on a ViewStack, and when I had that one more, and I opened the combo box (only when I open the combo box, didn't figure out why), the application really slowed down. So I took some components from the view stack and handled them using the add and remove child methods, and now it's speedy enough again.

Would still like to know why just opening one combo box in one more component would slow down the app like that.

webdreamer