Flex 中最好的视图架构是什么?
我已经开始学习 Flex 4,并且开始思考如何改变视图。所以我有一个问题人们通常使用什么 - 状态或视图(ViewStack)。我正在制作的 Web 应用程序类型可以同时使用两者,但是开发人员在大型项目中使用什么,或者他们可能不使用之前提到的那些?
我还有一个关于 ViewStack 的问题。如果我写:
<mx:ViewStack id="views" resizeToContent="true" verticalCenter="0" horizontalCenter="0" >
<s:NavigatorContent id="navOne">
<s:Label text="asdas" x="0" y="0"/>
</s:NavigatorContent>
那么我无法更改其子项的位置。标签保留在屏幕中央。如果我从 ViewStack 中删除垂直和水平中心并将它们放入 Label 的标签中,那么标签将位于左上角但不在中心。我如何控制这些位置?
I have started learning flex 4 and I got myself thinking about how to change views. So I have a question what do people usually use - states or views (ViewStack). The type of web application I am making, can use both, but what do developers use in big projects or maybe they use non of the mentioned before?
Also I have a question about ViewStack. If I write:
<mx:ViewStack id="views" resizeToContent="true" verticalCenter="0" horizontalCenter="0" >
<s:NavigatorContent id="navOne">
<s:Label text="asdas" x="0" y="0"/>
</s:NavigatorContent>
then I can't change location of its child. Label remains in the center of the screen. If I remove vertical and horizontal center from ViewStack and put them in Label's tags, then label will be in top left corner but not in center. How do I control those locations?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只要您使用 Flex 4,您就可以选择状态。至少有两个原因:
ViewStack
的 Spark 实现,而且它相当过时(需要使用NavigatorContent
与 Spark 容器是这一事实的另一个证明)。问题的第二部分。问题是您的 ViewStack 没有任何大小。所以最后它有内容的大小(
标签
大小)。所以verticalCenter
和horizontalCenter
只是你的ViewStack
的对齐方式。要控制 ViewStack 的大小和对齐方式,您应该关心大小。像这样的东西:As far as you're using Flex 4 you can prefer states. And there are at least two reasons for that:
ViewStack
and it is rather obsolete (necessarity of usingNavigatorContent
with Spark container is another proof of that fact).The second part of the question. The problem is your
ViewStack
hasn't any size. So finally it has size of content (Label
size). SoverticalCenter
andhorizontalCenter
are just alignment of yourViewStack
. To control size and alignment ofViewStack
you should care about sizes. Something like: