如何反向播放效果
在一个函数中,我调用效果的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
调用reverse()后,需要调用play():
After calling reverse(), you need to call play():