Flex application architecture, how can I create a component library that can be overridden

I have a rather large flex application that we just created for the client. Now the bossman tells me that more customers are interested in the application. However, their implementation will require several small settings (not always!).

We use Cairngorm and from what I can say so far, the only things that will differ between clients are views. Presently, the views are in the main flex application, and everything else is in the libraries.

So, I took the views (mxml components) and inserted them into the library so that all new client implementations could use them. So far, so good. So now I am creating a new Flex application project, linking to my new mxml component library, adding them to the main mxml application file, and the application works fine.

But here's the problem, how do I build this thing so that I can override the behavior in the default components with client components? It would be great if I could just add the Mxml file to the client Flex application, and the framework knows that it should override the default component. You could say that I can simply replace the component in the main application file, but I need the ability to change any component, even those that are deeply embedded in other custom components.

In Asp.net, you can use the "placeholder" control and then determine at run time which control to load. But I'm not sure how to do this in Flex.

How to build this thing?

+3
source share
2 answers

You can solve the problem using the factory class . Instead of instantiating the new components directly, you should ask the factory class to create the component for you, and based on some criteria (maybe a static constant value in the application?), The factory will decide which class to instantiate the component from.

, - : Factory ( "" ).

:

  • . , factory . == .
  • MXML, factory.
+1

, - . ( extends) , , , , .

, ( ), , . , .

0

All Articles