Flex 4 / Flash 4 添加到当前状态

发布于 2024-09-03 00:19:24 字数 601 浏览 10 评论 0原文

我在处理 Flex(或 Flash)4 中的状态时遇到了一些困难。假设我的应用程序具有三种状态;默认(基本)状态、状态 1 和状态 2。

状态 1 应始终基于基本状态,这很容易实现。但是,我希望状态 2 基于当前状态(基础状态或状态 1)。我这辈子都无法弄清楚。我尝试将状态 1 的 basedOn 属性设置为“this.currentState”,但这只会使我的浏览器崩溃。

 <s:states>
  <s:State name="default"/>
  <s:State name="state1"/>
  <s:State name="state2" basedOn="{this.currentState}"/>
 </s:states>

 <s:TitleWindow id="configWindow" includeIn="state1" width="250" height="100%" close="configWindow_closeHandler(event)"/>
 <s:Panel id="settings" includeIn="state2" width="200" height="200"/>

I am having a little difficulty working with states in Flex (or Flash) 4. Lets say that my application has three states; the default (base) state, state 1, and state 2.

State 1 should always be based on the base state, that's easy enough to accomplish. However, I would like state 2 to be based on the current state (either base or state 1). I can't for the life of me figure it out. I tried setting the basedOn property of state 1 to "this.currentState", but that just crashes my browser.

 <s:states>
  <s:State name="default"/>
  <s:State name="state1"/>
  <s:State name="state2" basedOn="{this.currentState}"/>
 </s:states>

 <s:TitleWindow id="configWindow" includeIn="state1" width="250" height="100%" close="configWindow_closeHandler(event)"/>
 <s:Panel id="settings" includeIn="state2" width="200" height="200"/>

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

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

发布评论

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

评论(1

泅渡 2024-09-10 00:19:24

basedOn 不是可绑定属性,这就是代码中该值不会更改的原因。

理论上,它是一个读/写属性,因此您可以在运行时更改它;但您必须手动执行此操作,可能是在 ActionScript 中。

根据您的代码片段;我不明白你为什么要这样做。一旦你将状态更改为“state2”,你不会进入一个奇怪的循环吗?

basedOn is not a Bindable property, which is why the value isn't changing in your code.

In theory, it is a read/write property so you can change it at runtime; but you'll have to do so manually, probably in ActionScript.

Based on your code snippet; I don't understand why you want to do this. As soon as you change the state to 'state2' wouldn't you enter into a weird loop?

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