在一个函数中,我在效果上调用play方法,在另一个函数中,我调用反向方法。播放方法有效,但反向方法不起作用。看来propertyChangesArray用于存储以前的效果起始值,但在调用reverse时该属性为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();
}
答案 0 :(得分:1)
调用reverse()后,需要调用play():
targetEffect.reverse( );
targetEffect.play( );