package {
import flash.display.Sprite;
import flash.utils.*;
public class SetTimeoutExample extends Sprite {
private var delay:Number = 1000; // delay before calling myDelayedFunction
public functi开发者_运维技巧on SetTimeoutExample() {
var intervalId:uint = setTimeout(myDelayedFunction, delay, "Hello", "World");
}
public function myDelayedFunction():void {
trace(arguments[0] + " " + arguments[1]);
}
}
}
i take an error about package what is wrong in this code?thanks
You need to create a new file called SetTimeoutExample.as
, and put the code in there. Make sure that the file is in the same directory as player.fla
. Then open player.fla, and in the properties window (Window > Properties), set the "Class" field to SetTimeoutExample
(without the .as).
精彩评论