我创建了一个有 5 个状态的主类:
<s:State name="loginState" />
<s:State name="librariesState"/>
<s:State name="createState"/>
<s:State name="profilesState"/>
</s:states>
每个状态都在一个新的 MXML 组件文件中创建,并在主类中调用如下:
<components:Homepage includeIn="homeState"/>
<components:LibrariesPage includeIn="librariesState"/>
<components:CreatePage includeIn="createState"/>
<components:ProfilesPage includeIn="profilesState"/>
在 homeState 中,我有三个按钮,通过单击将我带入 librariesState、createState 和 profilesState。我的问题是如何在 Homepage MXML 组件中调用状态视图(在主类中定义)。我试着写了click="currentState='librariesState',但是在Homepage中没有看到状态LibrariesState。如何从MXML组件中的主类中调用状态?