您好我已经制作了一个代码,所以如果您点击一个对象,该对象会消失,为此我使用了这段代码:
flap1.visible = false;
但是在整个动画期间对象需要保持错误
答案 0 :(得分:1)
Flash时间轴有点像静态状态机;从帧到帧的移动将在该帧(每次)运行所有文档代码。 It also resets the value of the content to the state it was in during design time(所以,帧=设计+代码)。由于这个模型可能引起的头痛,我强烈建议你做所有的设计和单帧中的代码。简而言之,不使用时间轴。
如果您还没准备好进行转换,并且想确保它保持隐藏状态,则需要在每一帧设置flap1
的可见性。这可能看起来像这样:
function toggleBtnListener(e:MouseEvent):void {
if (flap1.visible) {
flap1.visible = this.flap1Visibility = false;
} else {
flap1.visible = this.flap1Visibility = true;
}
}
flap1.visible = this.flap1Visibility;
您粘贴的代码有两个问题:
flap1.visible
设置移至Click
侦听器的内部。你希望它在侦听器之外,以便在每一帧上调用它修改后的代码:
import gs.*;
import gs.easing.*;
TweenMax.to(movieclip1, 2, {scaleX:4, scaleY:4, ease:Elastic.easeOut});
function move_to_top(e:MouseEvent):void {
if (flap1.visible) {
flap1.visible = this.flap1Visibility = false;
} else {
flap1.visible = this.flap1Visibility = true;
}
animateClip()
}
flap1.visible = this.flap1Visibility;
animateClip()
function animateClip():void {
if (flap1.visible == false) {
this.setChildIndex(movieclip1, this.numChildren - 1);
flap1.addEventListener(MouseEvent.CLICK, move_to_top);
}
}