Skip to content
This repository was archived by the owner on Mar 17, 2022. It is now read-only.

Commit 3afadab

Browse files
committed
update button scaler to fix audioMng not found issue.
1 parent bab9122 commit 3afadab

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

assets/scripts/UI/ButtonScaler.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ cc.Class({
1010
onLoad: function () {
1111
var self = this;
1212
var audioMng = cc.find('Menu/AudioMng') || cc.find('Game/AudioMng')
13-
audioMng = audioMng.getComponent('AudioMng');
13+
if (audioMng) {
14+
audioMng = audioMng.getComponent('AudioMng');
15+
}
1416
self.initScale = this.node.scale;
1517
self.button = self.getComponent(cc.Button);
1618
self.scaleDownAction = cc.scaleTo(self.transDuration, self.pressedScale);
1719
self.scaleUpAction = cc.scaleTo(self.transDuration, self.initScale);
1820
function onTouchDown (event) {
1921
this.stopAllActions();
20-
audioMng.playButton();
22+
if (audioMng) audioMng.playButton();
2123
this.runAction(self.scaleDownAction);
2224
}
2325
function onTouchUp (event) {

0 commit comments

Comments
 (0)