开发者

Flex: static var or use flexGlobals.topLevelApplication?

In Flex 4, if I have something like user information that I want to be able to access from anywhere in the application, is it better开发者_JAVA百科 to create a class with static var for the info or to have the variables in the top level application and access via flexGlobals.topLevelApplication?


Creating class with a static var is more preferable from the architecture point of view than coupling your client class with your top level application implementation. But the best way is to inject value in your client instance using delegation or dependency injection library/framework.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜