Flex 导航到另一个 Mxml 页面?
我在导航到 Flex 应用程序中的不同 MXML 页面时遇到困难。我检查了一些关于它的其他问题,但它们似乎与选项卡导航有关。 我正在尝试通过 Actionscript 代码从一个 MXML 页面导航到另一个页面。这怎么可能?
干杯
编辑:
我是Flex的真正初学者,我发现我实际上需要使用状态,并且现在已经发现了如何使用它们。感谢您的帮助。
I am having difficulty navigating to different MXML pages in my Flex application. I checked some other questions on SO about it but they seemed to be to do with tab navigation.
I am trying to navigate from one MXML page to another via Actionscript code. How is this possible?
Cheers
Edit:
I am a real beginner in Flex and I worked out that I actually needed to use States, and have now discovered how to use them. Thanks for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不需要在 MXML 页面之间导航。 MXML 本来就不是页面。相反,它们是显示在应用程序中的组件。所以如果你想改变当前的显示,那么你需要删除已经添加的组件,并添加现在应该显示的其他组件。
有不同的方法可以做到这一点。很少使用手动删除元素的非常原始的方法,而是有两种主要方法:ViewStacks 和显示状态。当视图中没有太多不同的更改时(例如,当您单击向现有公式添加新选项的复选框时),应使用显示状态。如果您想更改整个显示的内容(但这不一定是整个应用程序内容,而是考虑组件),您可以使用 ViewStacks。
ViewStack 就像一叠纸,每张纸都反映一个视图。因此,如果您想显示其他内容,请将新视图移动到顶部,隐藏下面的所有其他视图。许多组件(包括 TabNavigators)只是 ViewStack,带有一个附加菜单来选择应显示的视图。但您也可以只使用 ViewStack 并手动更改为您想要显示的内容。
You don't navigate between MXML pages. MXMLs are not pages to begin with. Instead they are components, that are displayed in the application. So if you want to change the current display, then you need to remove the already added components, and add others that should be displayed now.
There are different approaches to do this. The very raw way of manually removing elements is rarely used, instead there are two main methods: ViewStacks and display states. Display states should be used when there are not many different changes in a view, for example when you click a checkbox that adds new options to an existing formular. If you want to change the whole displayed content (this does not have to be the whole application content though, think in components instead), you can use ViewStacks.
ViewStacks are like a stack of paper, where each paper reflects a single view. So if you want to display something else, you move the new view to the top, hiding all others below. Many components, including TabNavigators, are just ViewStacks with an additional menu to select the view that should be displayed. But you can also just use a ViewStack and manually change to what you want to show.
Flex 不像 html 那样是基于侧面的。
您必须实例化或删除类、组件或所有这些东西。
我会使用美国。
您可以将处理程序注册到按钮并交换状态。
然后您就可以通过 tsates 来启动或删除组件。
您使用哪个 Flex 版本?状态管理在 Flex3 和 Flex4 之间发生变化
假设您有一个应用程序,其中包含两个内容区域:主页和图库。首先,您必须使用项目->新建->组件创建这两个区域,并命名为相关的。
之后,您在应用程序中实例化这两个组件。
定义两个状态:主页和画廊,并用一两个按钮交换它们。
将属性排除或包含与状态名称一起设置。最后,您有一个具有两个内容区域的应用程序,但您从不交换页面,而是在运行时实例化或删除组件。
br
弗兰克·
BR
坦率
Flex is not sidebased like html.
You have to instantiate or remove classes, components or all this stuff.
i would use the states.
You can register handler to buttons and swap the state.
Then you are able to instatiate or remove components via the tsates.
Which flex version dou you use? The management of the states are changing between flex3 and flex4
Assume, you have one app with two content areas, home and gallery. First you have to create these two areas with project->new->component and named there related.
After that, you instanciate both components in your app.
Define two states, home and gallery and swap these with a button or two.
set the propert excludefrom or include with the name of the states. finally, you have an app with two content areas, but you never swap pages, you instanciate or remove components in runtime.
br
Frank
BR
Frank