开发者

ASC3 (ActionScript 3) begin listening when a frame begins, how do I?

Alright, I'm working on a Droid app and need some help. I need to load some variables when the user begin the game. But I don't want to do this when the user click something. I want it to be performed when the user enters a frame. How would I do this. I have tried the below code but that doesn't work.

start.addEventListe开发者_如何转开发ner(Event.START, check);
function check(event:MouseEvent):void{
    cash.text.text = cash1;
    storage_count.text.text = storage1;
    lemons_count.text.text = lemons1;
    cups_count.text.text = cups;
    straws_count.text.text = straws;
    ice_count.text.text = ice;
    }


You can use the enter frame event to call a function at the beginning of each frame, like this

addEventListener(Event.ENTER_FRAME, do_something);

// elsewhere
function do_something(ev : Event) : void {
    // do something
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜