flex/flashbuilder 4 浓汤状态有时为空白

发布于 2024-10-03 11:29:30 字数 1143 浏览 3 评论 0原文

下面是一个非常简单的示例,随机地,如果我单击第 2 步按钮,状态将发生变化,但第 2 步面板不会出现。

我怀疑由于某种原因没有创建状态的子级,这就是为什么我将 itemCreationPolicy 设置为“立即”,但这没有什么区别

这对应用程序来说是灾难性的,因为用户陷入困境并被迫刷新

有什么想法吗?

 <s:BorderContainer xmlns:fx="http://ns.adobe.com/mxml/2009" 
                       xmlns:s="library://ns.adobe.com/flex/spark" 
                       xmlns:mx="library://ns.adobe.com/flex/mx" 
                       creationPolicy="all" currentState="step1">   
        <s:states>
            <s:State name="step1"/>
            <s:State name="step2"/>
        </s:states>
        <s:BorderContainer includeIn="step1" itemCreationPolicy="immediate">
            <s:Panel title="Step 1"/>  
        </s:BorderContainer>
        <s:BorderContainer includeIn="step2" itemCreationPolicy="immediate">
            <s:Panel title="Step 2"/>  
        </s:BorderContainer>
        <s:Button title="step1" click="{this.setCurrentState('step1',true)}"/>
        <s:Button title="step2" click="{this.setCurrentState('step2',true)}"/>
    </s:BorderContainer>

Below is a very simple example, randomly, if I click the step2 button the state will change but the Step 2 panel will not be there.

I suspect the children of the state are not getting created for some reason, which is why I set the itemCreationPolicy to "immediate", but it makes no difference

This is catastrophic for the application because the user is left in limbo and is forced to refresh

Any ideas, please?

 <s:BorderContainer xmlns:fx="http://ns.adobe.com/mxml/2009" 
                       xmlns:s="library://ns.adobe.com/flex/spark" 
                       xmlns:mx="library://ns.adobe.com/flex/mx" 
                       creationPolicy="all" currentState="step1">   
        <s:states>
            <s:State name="step1"/>
            <s:State name="step2"/>
        </s:states>
        <s:BorderContainer includeIn="step1" itemCreationPolicy="immediate">
            <s:Panel title="Step 1"/>  
        </s:BorderContainer>
        <s:BorderContainer includeIn="step2" itemCreationPolicy="immediate">
            <s:Panel title="Step 2"/>  
        </s:BorderContainer>
        <s:Button title="step1" click="{this.setCurrentState('step1',true)}"/>
        <s:Button title="step2" click="{this.setCurrentState('step2',true)}"/>
    </s:BorderContainer>

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

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

发布评论

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

评论(2

装纯掩盖桑 2024-10-10 11:29:30

我刚刚使用 Flex SDK 4.1 对其进行了测试,它可以在不更改创建策略的情况下工作。单击“步骤 2”成功更改状态。

顺便说一句:您不需要在单击事件处理程序中使用花括号...

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx" currentState="step1">

    <s:layout>
        <s:VerticalLayout/>
    </s:layout>

    <s:states>
        <s:State name="step1"/>
        <s:State name="step2"/>
    </s:states>

    <s:BorderContainer includeIn="step1">
        <s:Panel title="Step 1"/>
    </s:BorderContainer>

    <s:BorderContainer includeIn="step2">
        <s:Panel title="Step 2"/>
    </s:BorderContainer>

    <s:Button label="step1" click="setCurrentState('step1', true)"/>
    <s:Button label="step2" click="setCurrentState('step2', true)"/>
</s:Application>

I've just tested it with Flex SDK 4.1 and it works without changing the creation policy. Clicking "step 2" successfully changes the state.

BTW: You don't need the curly braces in you click event handler...

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx" currentState="step1">

    <s:layout>
        <s:VerticalLayout/>
    </s:layout>

    <s:states>
        <s:State name="step1"/>
        <s:State name="step2"/>
    </s:states>

    <s:BorderContainer includeIn="step1">
        <s:Panel title="Step 1"/>
    </s:BorderContainer>

    <s:BorderContainer includeIn="step2">
        <s:Panel title="Step 2"/>
    </s:BorderContainer>

    <s:Button label="step1" click="setCurrentState('step1', true)"/>
    <s:Button label="step2" click="setCurrentState('step2', true)"/>
</s:Application>
遇见了你 2024-10-10 11:29:30

看来您使用的是旧版/预发布版本的 Flex 4 SDK。更新到 4.1.0(最后一个稳定版本)可能是个好主意。

PS:编写 this.setCurrentState('step1',true) 并不是最好的主意。我建议使用 currentState = 'step1' - 这是状态更改的官方方式。

Seems that you use old / pre-release version of Flex 4 SDK. It might be a good idea to update to 4.1.0 - last stable version.

P.S: Writing this.setCurrentState('step1',true) is not the best idea. I suggest to use currentState = 'step1' - it is the official way of state changing.

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