开发者

Difference between <s:VGroup> and "<s:Group> with vertical layout"

开发者 https://www.devze.com 2023-01-16 20:14 出处:网络
I am trying to get some hands on Flex 4. When it came 开发者_如何学Pythonto choose between VGroup and Group, I am a bit confused.

I am trying to get some hands on Flex 4. When it came 开发者_如何学Pythonto choose between VGroup and Group, I am a bit confused. Is there some good reason/distinction between the two, namely VGroup and Group with vertical layout. Which one should a develpoer prefer to get best performance ?

Thanks in advance.


From the Flash Builder Help:

"The VGroup container is an instance of the Group container that uses the VerticalLayout class. Do not modify the layout property. Instead, use the properties of the VGroup class to modify the characteristics of the VerticalLayout class."

So, in terms of performance I believe that is best using the Parent Component Group with its layout set to vertical.

<s:Group>
    <s:layout>
        <s:VerticalLayout/>
    </s:layout>        
    <s:Label text="Hello World"/>
</s:Group>


There is no practical difference. VGroup and HGroup are short-hand which can be more readable if you have a lot of them in one file.

Group can have its layout changed at runtime, whereas VGroup's layout is fixed, so obviously you should use Group if you want to be able to let your users change that. There may also be some obscure use-case for VGroup where you need to guarantee that a container is vertical and its layout cannot be changed, but none spring immediately to mind...

In terms of performance, the only difference could be in the getter/setter wrapper functions. This is totally insignificant; you'll have to be changing the layout properties in a very large loop to see any difference - which would mean you are already killing performance pointlessly; so I would make my decision purely on readability.

0

精彩评论

暂无评论...
验证码 换一张
取 消