被调程序中setInterval的删除

      flash学习 2005-4-23 17:25
这是被调用的a.swf中的代码:
var j = 0;
var ycccc = this;
_root.ycccc_inter = setInterval(function () {
    if (ycccc == undefined) {//这个判断是关键
        clearInterval(_root.ycccc_inter);//_root.ycccc_inter也挺关键的
    }
    trace(j++);
}, 1000);
然后主程序main.swf中进行loadMovie("a.swf"),再用个按钮进行控制unloadMovie,假如a.swf中没加上那句判断的话,setInterval程序还会继续执行,不过由于其他变量都删除了,所以trace出的都是undefined.
//
有问题的话大家可以提出.
标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commentauthor}
{commentauthor}
{commenttime}
{commentnum}
{commentcontent}
作者:
{commentrecontent}