简体   繁体   中英

How to use setTimeout in Flash AS3

In JavaScript:

setTimeout("document.write('example')", 200);

I want to know how I can do a setTimeout in Flash (AS3).

I know there's the Timer() class, but I want a more simple way to do this.

setTimeout is exactly the same in flash as it is in JavaScript. It can be found in the flash.utils package.

So:

import flash.utils.setTimeout;

setTimeout(trace,200,"hello world");

eg:

setTimeout(functionToCall, delayInMilliseconds, optionalArgument1, optionalArgument2, etc);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM