ccc this 指针

cc.Class({
    extends: cc.Component,

    properties: {
        musicPlayer: {
            default: null,
            type: cc.AudioSource
        },
        dingClip: {
            default: null,
            url: cc.AudioClip
        },
        cheeringClip: {
            default: null,
            url: cc.AudioClip
        }
    },

    // use this for initialization
    onLoad: function () {
        var self = this;
        // play audioSource
        self.musicPlayer.play();

        // play ding in 1 sec, play cheering in 2 sec
        setTimeout(function() {
            cc.audioEngine.playEffect(self.dingClip, false);
            setTimeout(function() {
                cc.audioEngine.playEffect(self.cheeringClip, false);
            }, 2000);
        }, 1000);
    },

    // called every frame
    update: function (dt) {

    },
});

posted @ 2016-04-29 15:26  yufenghou  阅读(137)  评论(0编辑  收藏  举报