如何反向播放效果

发布于 2024-11-26 10:23:13 字数 1332 浏览 2 评论 0原文

在一个函数中,我调用效果的 play 方法,在另一个函数中,我调用反向方法。 play 方法有效,但反向方法无效。 propertyChangesArray 似乎用于存储先前的效果起始值,但在调用反向时该属性为 null。我该怎么做?

代码:

        private var targetEffect:SetAction = new SetAction();
        public var sequence:Sequence = new Sequence();

        protected function play_clickHandler(event:MouseEvent):void {
            targetEffect.target = sparkImage;
            targetEffect.property = "width";
            targetEffect.captureStartValues();
            targetEffect.value = 300;
            trace("properties change array " + targetEffect.mx_internal::propertyChangesArray); // [Object]

            if (sequence.children.length==0) {
                sequence.addChild(targetEffect);
            }


            sequence.captureStartValues();
            trace("properties change array " + sequence.mx_internal::propertyChangesArray); // [Object]
            sequence.play();
        }


        protected function reverse_clickHandler(event:MouseEvent):void {
            var o:Object = targetEffect.mx_internal::propertyChangesArray;
            trace("reverse properties change array " + o); // null
            o = sequence.mx_internal::propertyChangesArray;
            trace("reverse  " + o); // null
            targetEffect.reverse();
            sequence.reverse();
        }

In one function I am calling the play method on an effect and in another I am calling the reverse method. The play method works but the reverse method does not. It appears that the propertyChangesArray is used to store the previous effect start values but that property is null when calling reverse. How do I do this?

Code:

        private var targetEffect:SetAction = new SetAction();
        public var sequence:Sequence = new Sequence();

        protected function play_clickHandler(event:MouseEvent):void {
            targetEffect.target = sparkImage;
            targetEffect.property = "width";
            targetEffect.captureStartValues();
            targetEffect.value = 300;
            trace("properties change array " + targetEffect.mx_internal::propertyChangesArray); // [Object]

            if (sequence.children.length==0) {
                sequence.addChild(targetEffect);
            }


            sequence.captureStartValues();
            trace("properties change array " + sequence.mx_internal::propertyChangesArray); // [Object]
            sequence.play();
        }


        protected function reverse_clickHandler(event:MouseEvent):void {
            var o:Object = targetEffect.mx_internal::propertyChangesArray;
            trace("reverse properties change array " + o); // null
            o = sequence.mx_internal::propertyChangesArray;
            trace("reverse  " + o); // null
            targetEffect.reverse();
            sequence.reverse();
        }

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

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

发布评论

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

评论(1

乖乖 2024-12-03 10:23:13

调用reverse()后,需要调用play():

targetEffect.reverse(  );
targetEffect.play(  );

After calling reverse(), you need to call play():

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