2
我有兩個動畫片段。當左側懸停在動畫上時,.box會從右向左移動,但當左側沒有懸停時停止。Flash ActionScript 3 - 反向播放動畫
我想與.right一樣發生,但動畫.box播放相反。我可以實現所有這一切,除非我不能讓動畫停止播放,當.right沒有被覆蓋時,它會一直持續到.box再次開始播放。
最終我想把這個概念變成水平網站的滾動。提前致謝。
下面的代碼,我有那麼遠,
import flash.events.MouseEvent;
left.addEventListener(MouseEvent.MOUSE_OVER,left_scroll_over);
left.addEventListener(MouseEvent.MOUSE_OUT,left_scroll_off);
right.addEventListener(MouseEvent.MOUSE_OVER,right_scroll_over);
right.addEventListener(MouseEvent.MOUSE_OUT,right_scroll_off);
//scrolling left
function left_scroll_over(e:MouseEvent):void
{
box.play();
right.visible = true;
}
function left_scroll_off(e:MouseEvent):void
{
box.stop();
if (box.currentFrame == 59)
{
left.visible = false;
right.visible = true;
}
}
// scrolling right
function right_scroll_off(e:MouseEvent):void
{
box.stop();
}
function right_scroll_over(e:MouseEvent):void
{
this.addEventListener(Event.ENTER_FRAME, playReverse, false, 0, true);
}
function playReverse(e:Event):void
{
if (box.currentFrame == 1)
{
stopPlayReverse();
right.visible = false;
left.visible = true;
}
else
{
box.prevFrame();
left.visible = true;
}
}
function stopPlayReverse():void
{
if (this.hasEventListener(Event.ENTER_FRAME))
{
this.removeEventListener(Event.ENTER_FRAME, playReverse);
}
}