0

TextArea.text 值未设置或保持设置。当我有一个过渡并且使用 Rotate3D 并且有两个过渡时,就会发生这种情况。通过一次过渡,它就可以工作。有两个转换(返回转换)它没有。所以在下面的例子中,我有一个从“note”到“list”的过渡。如果我添加从“列表”到“注释”的转换,那么就会发生这种行为。但是,如果我将 textArea (note) 放在两个状态中,那么它可以正常工作(即 incluedIn="note,list" 有效)!

<s:Group id="noteGroup" includeIn="note">

    <s:TextArea id="normalTextArea" />

</s:Group>


<s:transitions>
    <s:Transition fromState="note" toState="list"
                  autoReverse="false">
        <s:Sequence target="{this}"
                    duration="{duration}" >
            <s:Rotate3D angleYFrom="0" angleYTo="90" 
                        autoCenterTransform="true" 
                        applyChangesPostLayout="true"
                        />
            <s:SetAction target="{noteGroup}" property="visible" />
            <s:RemoveAction target="{noteGroup}" />
            <s:AddAction target="{listGroup}"/>
            <s:Rotate3D angleYFrom="-90" angleYTo="0" 
                        autoCenterTransform="true" 
                        applyChangesPostLayout="true"/>
        </s:Sequence>
    </s:Transition>

    <s:Transition fromState="list" toState="note"
                  autoReverse="false"
                  >
        <s:Sequence target="{this}" duration="{duration}" >

            <s:Rotate3D angleYFrom="0" angleYTo="-90" 
                        effectStart="trace('rotateStart')"
                        duration="250" 
                        autoCenterTransform="true"
                        applyChangesPostLayout="true" />

            <s:AddAction target="{noteGroup}"
                        effectStart="trace('add notes action')"/>
            <s:SetAction target="{noteGroup}" property="visible" />
            <s:RemoveAction target="{listGroup}" 
                        effectStart="trace('remove lists action')"/>

            <s:Rotate3D angleYFrom="90" angleYTo="0" 
                        effectStart="trace('rotateStart 2')"
                        duration="250" 
                        autoCenterTransform="true"
                        applyChangesPostLayout="true" />

        </s:Sequence>
    </s:Transition>

</s:transitions>

~~更新~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~

我提到的一种解决方法是在两种状态下都包含 textarea,然后在它最初不包含在的状态下将 visible 设置为 false:

<s:Group id="noteGroup" 
         includeIn="note,list"
         visible.list="false">

    <s:TextArea id="normalTextArea" />

</s:Group>

~~更新~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~
稍后(过渡后)设置值(感谢Flextras)但在我将光标放在文本区域之前,文本不可见。

列出更改处理程序代码:

protected function list1_changeHandler(event:IndexChangeEvent):void {
    content = (list.selectedItem as Note).content;
    currentState = "note";

    setTimeout(setText,1000);
}

private function setText():void {
    normalTextArea.text = content; // works but only on clicking into the textarea
}

这不起作用:

        protected function list1_changeHandler(event:IndexChangeEvent):void {
            content = (list.selectedItem as Note).content;
            normalTextArea.text = content;
            trace('1 text ='+normalTextArea.text); // contains content
            currentState = "note";
            normalTextArea.text = content;
            trace('2 text ='+normalTextArea.text); // contains content

            setTimeout(setText,1000);
        }

        // scenario 1
        private function setText():void {
            normalTextArea.text = content; // clicking into textarea it is empty
        }

        // scenario 2
        private function setText():void {
            normalTextArea.text = ""; // this does work but
            normalTextArea.text = content; // you have to click into textarea
        }
4

0 回答 0