Flex 4.0: Common function across modules
We are working on a project where we have multiple modules- all these share a common set of functions like rounding, string parsing etc.
Currently, we have added these func开发者_C百科tions into the parent container (which calls these modules) and use them in the respective modules. Likewise, if we have to share variables between modules, we add them to the parent module- so it becomes shareable across.
Is this the right approach- both from a performance and structure perspective?
You should create a runtime shared library project (RSL) and have some classes with static functions. That is how we do it. This can be shared between all of the modules, also you can then use that RSL for any future projects as well.
Maybe you are looking about Singletons.
Check my answer here please : use actionscript file in flex library
精彩评论