Flash8中的setTimeout

原文的地址是http://www.flashguru.co.uk/flash-8-settimeout/。原来Flash8中已经隐藏了setTimeout方法。

使用过JavaScript都知道,JS有setInterval和setTimeout两个可以延时的方法。而在AS中一直都没有 setTimeout,今天在网上无意见看到有关在Flash8中有setTimeout的说法,测试了以下,果然是。
没有setTimeout的时候,必须使用clearInterval来配合方法的延迟执行。有setTimeout后的确要方便许多。不过这个方法是Flash8的隐藏方法,该函数属于未公开的函数的原因,很大可能是因为在flash player9和AS3中已经不推荐或者取消了这个方法。
使用方法和setInterval是一样的:

setTimeout(function_name, time, params);

原文提到特别注意的地方:
如果是是用AS2的类里面使用setTimeout函数,因为该函数属于未公开的函数,所以必须使用下面的方法才能避免编译出错
代码:

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

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Hello world

Hi,我是Tang Bin,finalbug.org是我的个人站点。这里有更多关于我的内容。English readers please click here to learn more about me and this site.

Categories