CGArt-中国CGer中的绿色家园
首页 信息动态 原创排行 互动教程 资源千寻 CG人才 CGArt杂志 艺术设计 CG画廊 CG论坛 酷站欣赏 CG搜索 会员中心
学习Flash8中的setTimeout函数的用法
来源:网页教学网 作者:闪电儿 编辑:浪漫的季节 发布时间:2007年05月24日 18:09:52

在Flash8中,有个未公开的函数setTimeout,执行功能就是在设定的时间到了以后,调用一次设定的函数。 这样对于只需要调用一次的时间触发事件,我们再也不需要用 setInterval 函数配合  clearInterval 函数来处理了.  很好用,该函数属于未公开的函数的原因,很大可能是因为在flash 8.5中属于非推荐语法,所以隐藏了.

用法:

function openWebsite(url:String) {
 getURL(url, "_blank");
}
website = "http://www.webjx.com/";
setTimeout(openWebsite, 1000, website);
stop();

或者

function openWebsite(url:String)
{
    getURL(url,"_blank");
}
website='http://www.webjx.com';
setTimeout(this,'openWebsite',1000,website);

特别注意:

如果是是用AS2的类里面使用setTimeout函数,因为该函数属于未公开的函数,所以必须使用下面的方法才能避免编译出错

_global["setTimeout"](this,"openWebsite",1000,website);

共有评论0条
更多评论..
作者信息 详细信息
评论人:
验证码:
内容:
 
about us advertisement publish conformity service cooperate associate link site map contact us help jump to the top of page