简体   繁体   中英

Flex 4.5: States vs Components

Can you suggest me when to use states and when to use custom components? The advantages and disadvantages of using these too methods?

One problem I see using states in Flex 4.5 is, the includeIn property will be cumbersome if there are many states and needs to be set for individual container/controllers.

Thanks Anji

Doesn't the use of states groups solve your problem and clarify all the combersome mess?

States and customs components are not hostile alternatives. They can be used together. It is not very clear form your questions what exact kind of components do you mean and why they solve includeIn problem.

You can refer to ActionScript and MXML visual classes as visual components. And one of the purposes of producing of such components is to reduce complexity. So if you have very complex states logic in some visual component (in MXML) it is very good to extract some subcomponents with corresponding states into separate components. These extracted components can be MXML components and can contain states with includeIn / excludeFrom logic. Or they can be ActionScript components with skin states.

States and extracting components can live together easily. One of developer's main goals is to reduce complexity. And common sense is the best weapon to do that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM