单击影片剪辑的按钮,为何显示主时间轴的totalFrames,currentFrame未定义

var inc:Number = 0;

prevBtn.addEventListener(MouseEvent.CLICK, preprog);

function preprog(event:MouseEvent):void
{
    if (root.currentFrame == 1) {
        gotoAndStop(1);
    } else {
        inc = root.currentFrame-1;
        gotoAndStop(inc);
    }
}

nextBtn.addEventListener(MouseEvent.CLICK, nextprog);

function nextprog(event:MouseEvent):void
{
    if (root.currentFrame == root.totalFrames) {
        gotoAndStop(root.totalFrames);
    } else {
        inc = root.currentFrame+1;
        gotoAndStop(inc);
    }
}

舞台上有8张图片,通过单击舞台上的影片剪辑按钮,播放主时间轴的图片。

获取到总帧数的是属性.TotalFrames,而不是属性TotalFrames()。在asp.net中,js放在最后可以在一定程度上避免当前flash没有加载完,导致获取总帧数undefined的情况。另一种办法是为body 添加onload事件,指向js函数。具体各个flash操作函数参考以下链接http://blog.csdn.net/lzkkevin/article/details/6789593

是ANIMATE CC编辑的AS3脚本,舞台上单击影片剪辑按钮,无法获得主时间轴的当前帧和总帧数,一直显示 root.TotalFrames,root.currentFrame未定义,去除root,则不出错,但我的是主时间上的当前帧和总帧数,不是要影片剪辑当前帧和总帧数。
但还是要感谢你的回复,虽然没有解决问题。

此问题我已解决了,无需帮助了