开发者

Multi page database application in Flash Builder - how to access/call different screens?

I am trying to create my first real world application. It's a database driven (via Web Services) application in Flash Builder 4.

The application will have over 30+ different data entry form screens, list screens, search screens etc that all use different web services.

Obviously I want to split this up so that it's manageable as the application grows, and so that the applic开发者_如何学运维ation is as fast as possible (initial loading can be slow if it has to load all the elements, but I want it to be fast once the user is "in" the app).

The approach I had up until now was to have my main application (called layout), and then have a ViewStack with each of the different screens on it. This works well, however it means there is a fair bit of code to be maintained each time I add a new screen (info on that is here: Swap MXML Component in Application from another Component - Possible? )

Each group of forms are related, so the "clients" area of the application has a data entry form, a few list forms. I need to pass parameters when it loads. ie. "Load the data entry form with the ID of 123".

At the moment I have a Component for each form, ie. ClientForm and ClientList. Is this a good approach? Should I be using Modules instead?

Is the ViewStack an efficient way of doing it?


If I'd develop such kind of application I'd reject view stacks and accept states. They are got much more better since Flex 2/3 states. The main advantage of states in comparison with view stacks is you haven't create some additional containers/holders for your child containers. Another advantage is a possibility to switch states using string identifiers which you can easily pass with your events without necessity to use some mapping between string identifiers and views. Just using the same strings as state names. So it will be loosely coupled and pretty modularized.

Another advice is try to break your application into small independent components/classes as it possible. Try to isolate all the calls to the server into separate actions/commands. You can use some architectural framework for that if you'd like it (like Mate, Parsley or something else; just avoid Cairngorm or PureMVC).

Preform analyzing your screens and calls. Is there a finite number of screens and calls? Is it probable they have to be added in future? How often they'll be added? In case of finite number of screens with rare possibility of adding one/two screens in future you can place all your states in one MXML component extracting views themselves into separate components using event model for getting feedback from them with custom events. If there are rather great amount of views you can form some hierarchy of views grouping states on a separate subcomponents to have readable (and maintainable) code.

Another strategy is using modules if there is really great amount of forms/views and they can be added in future regularly. In this case you should provide some configuration file (I suggest XML file) with modules description. The main application loads that configuration and then decided how to load and display modules and which events to listen and react.

I hope directions enumerated above can be good starting point to plan your application. Good luck!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜