@luke2125 wrote:
Hi,
Have a button, and trying to change image of Music ON -> Music OFF, however, sprite is not changing.....
cc.Class({
extends: cc.Component,properties: { // musicoffsprite:cc.SpriteFrame }, // use this for initialization onLoad: function () {
this.count = 0;
this.MusicOnOffPress();
},
MusicOnOffPress:function(){
this.node.on(cc.Node.EventType.TOUCH_START, function (event) {
var music = this.getComponent(cc.AudioSource);
music.pause();
this.count++;
**var sprite = this.getComponent(cc.Sprite);
sprite.spriteFrame = new cc.SpriteFrame("assets/Hud Texture/musicoffbuttongraphic.png");**
if(this.count>=2){
music.resume();
this.count = 0;
}},this);},Any help will be appreciated it......God Bless...
Sincerely,
Sunday
Posts: 2
Participants: 2