我有MC1,当点击时,我想让它等待,这样当MC2命中第50或100帧时,它就会开始播放。两者都有各自独立的时间线。有什么帮助吗?
发布于 2013-07-08 23:46:11
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-08 23:57:40
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();
}
}https://stackoverflow.com/questions/17530677
复制相似问题