基于多个状态的弹性状态

发布于 2024-08-13 15:21:54 字数 592 浏览 6 评论 0原文

在flex中是否可以将多个状态分配为另一个状态的基础? 假设我有添加按钮“buttonA”的状态“stateA”和添加按钮“buttonB”的状态“stateB”。是否可以创建基于状态“stateA”和“stateB”的状态“stateC”? 如果没有,是否有解决方法可以实现这一点?

另请注意,按钮 ID 应该是“buttonA”和“buttonB”,并且我不能有多个处于不同状态且具有相同 ID 的按钮...

这是我想要的示例:

<mx:State name="stateA">
 <mx:AddChild>
  <mx:Button id="buttonA" />
 </mx:AddChild>
</mx:State>
<mx:State name="stateB">
 <mx:AddChild>
  <mx:Button id="buttonB" />
 </mx:AddChild>
</mx:State>
<mx:State name="stateC" basedOn="stateA,stateB">
</mx:State>

Is it possible, in flex, to assign multiple states as base for another state?
Say I have state "stateA" that adds a button "buttonA" and state "stateB" that adds a button "buttonB". Is it possible to create a state "stateC" that is based on state "stateA" and "stateB"?
If not, is there a workaround to accomplish that?

Also notice that the button IDs should be "buttonA" and "buttonB" and I can't have several buttons in different states with the same ID ...

Here is an example of what I want:

<mx:State name="stateA">
 <mx:AddChild>
  <mx:Button id="buttonA" />
 </mx:AddChild>
</mx:State>
<mx:State name="stateB">
 <mx:AddChild>
  <mx:Button id="buttonB" />
 </mx:AddChild>
</mx:State>
<mx:State name="stateC" basedOn="stateA,stateB">
</mx:State>

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

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

发布评论

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

评论(1

翻身的咸鱼 2024-08-20 15:21:54

我认为这是不可能的。但我似乎有一个针对这种特殊情况的解决方法:

  • stateC 具有 buttonAbuttonB
  • stateA,基于在 stateC 上,删除 buttonB
  • stateB,基于 stateC,删除 buttonA

那满足您的用例吗?

I don't think that is possible. But I seem to have a work around for this particular case:

  • stateC has both buttonA and buttonB
  • stateA, based on stateC, removes buttonB
  • stateB, based on stateC, removes buttonA

Would that suffice your use-case?

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