Flex 4 中的全局状态

发布于 2024-08-07 03:22:59 字数 1317 浏览 1 评论 0原文

Flex 4 引入了皮肤内和组件内的本地化状态。这在 MVC 模型上是有意义的,因此视觉元素可以有自己的状态(即按钮:向上、向下、上方等),这些状态与组件的状态分开。然而,如何创建一个全局应用程序状态呢? SDK 中是否已有与我正在寻找的内容类似的内容?

进一步说明:假设我们有一个具有 3 个独立“模式”的应用程序,这些模式不仅会更改当前元素的视觉外观,还会更改容器或组件的属性和元素。因此,不仅为每个组件和皮肤拥有状态,而且为整个应用程序拥有状态,这将非常有用。基本上,它是另一个抽象层。回到按钮示例,假设我们有向上、向下和经过状态,但是全局应用程序状态 1 有 3 个单独的向上、向下和经过状态,全局应用程序状态 2 有另外 3 个单独的状态,依此类推等等。

对于视觉学习者:

按钮的自定义皮肤中的状态可能与全局应用程序状态类似:

         <s:states>
            <s:ApplicationState name="mode1">
                <s:State name="up" />
                <s:State name="over" />
                <s:State name="down" />
            </s:ApplicationState>
            <s:ApplicationState name="mode2">
                <s:State name="up" />
                <s:State name="over" />
                <s:State name="down" />
            </s:ApplicationState>
            <s:ApplicationState name="mode3">
                <s:State name="up" />
                <s:State name="over" />
                <s:State name="down" />
            </s:ApplicationState>
        </s:states>

        <s:Button label.mode1.up="Application is in mode1" label.mode2.up="Application is in mode2" label.mode3.over="etc., etc., etc."/>

谢谢

Flex 4 introduces states that are localized within a skin, and within a component. This makes sense on an MVC model, so the visual elements can have their own states (i.e. for a button: up, down, over, etc.) which are separate from a component's state. Yet, how would one go about making a global application state? Is there something already in the SDK similar to what I'm looking for?

Further clarification: Let's say we have an application that has 3 separate "modes" that will change not only the visual appearance of current elements, but the properties and elements of a container or component. Therefore, it would be highly useful to have states for not only every component and skin, but have states for the entire application. Basically, it's another layer of abstraction. Going back to the button example, say we have the up, down and over states, but then there are 3 separate up, down and over states for global application state 1, and another 3 separate states for global application state 2, and so on and so forth.

For you visual learners:

states in a custom skin for a button might look like this with global application states:

         <s:states>
            <s:ApplicationState name="mode1">
                <s:State name="up" />
                <s:State name="over" />
                <s:State name="down" />
            </s:ApplicationState>
            <s:ApplicationState name="mode2">
                <s:State name="up" />
                <s:State name="over" />
                <s:State name="down" />
            </s:ApplicationState>
            <s:ApplicationState name="mode3">
                <s:State name="up" />
                <s:State name="over" />
                <s:State name="down" />
            </s:ApplicationState>
        </s:states>

        <s:Button label.mode1.up="Application is in mode1" label.mode2.up="Application is in mode2" label.mode3.over="etc., etc., etc."/>

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

可是我不能没有你 2024-08-14 03:22:59

不,不支持这样的“子”状态。你可以做的是 mode1_up, mode1_over, mode1_down, mode2_up, mode2_over, mode2_down
然后根据私有变量确定您所处的模式并相应地切换。你认为这对你想做的事情有用吗?

no, there is not support for "sub" states like this. What you could do though is have mode1_up, mode1_over, mode1_down, mode2_up, mode2_over, mode2_down etc
and then just have which mode you are in based on a private variable and switch out accordingly. do you think that would work for what you are trying to do?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文