1

我有 MC1,单击时我希望它等待,以便在 MC2 达到第 50 帧或第 100 帧时开始播放。两者都有自己的单独时间线。有什么帮助吗?

4

2 回答 2

3

addFrameScript 将允许您在影片剪辑帧中添加和删除代码。

function onMc1Click(e:MouseEvent):void
{
  //targetFrame:int = 50  declared in class..
  mc2instance.addFrameScript(targetFrame, mc2TargetFrameReached);
  mc2instance.play();
}

function mc2TargetFrameReached():void
{
  //call with null function value to remove 
  mc2instance.addFrameScript(targetFrame,null);

  //do other stuff
}
于 2013-07-08T15:46:10.963 回答
1
mc1.addEventListener(MouseEvent.CLICK, onMc1Click);

function onMc1Click(e:MouseEvent):void
{
  mc2.addEventListener(Event.ENTER_FRAME, onFrameMc2);
  mc2.play();
}

function onFrameMc2(e:Event):void
{
  if(mc2.currentFrame == 50 || mc2.currentFrame == 100)
  {
    mc2.removeEventListener(Event.ENTER_FRAME, onFrameMc2);
    mc1.play();
  }
}
于 2013-07-08T15:57:39.527 回答