User prompt
Fix Bug: 'Error: The supplied DisplayObject must be a child of the caller' in this line: 'self.visible = false;' Line Number: 15
User prompt
Fix Bug: 'Error: The supplied DisplayObject must be a child of the caller' in this line: 'self.visible = false;' Line Number: 16
User prompt
Fix Bug: 'Error: The supplied DisplayObject must be a child of the caller' in this line: 'self.visible = false;' Line Number: 17
User prompt
Fix Bug: 'ReferenceError: settingsBackground is not defined' in this line: 'self.visible = false;' Line Number: 17
User prompt
z-index the newly spawned individual objects so that they are behind the settings menu
User prompt
Fix Bug: 'TypeError: game.getChildByName is not a function' in this line: 'var object3 = game.getChildByName('object3');' Line Number: 74
User prompt
Fix Bug: 'TypeError: game.getChildByName is not a function' in this line: 'var object2 = game.getChildByName('object2');' Line Number: 55
User prompt
Fix Bug: 'TypeError: game.getChildByName is not a function' in this line: 'var object1 = game.getChildByName('object1');' Line Number: 36
User prompt
add object1 object2 and object3 only appear when setting1 setting2 and setting3 are activated
===================================================================
--- original.js
+++ change.js
@@ -32,9 +32,9 @@
}
});
self.activateSetting1 = function () {
console.log('Setting 1' + (self.isSelected ? ' was activated' : ' was deactivated'));
- var object1 = game.getChildByName('object1');
+ var object1 = getChildByName(game, 'object1');
if (self.isSelected) {
setGameSetting('setting1', true);
if (!object1) {
object1 = game.addChild(new Object1());
@@ -192,8 +192,16 @@
*/
/*
* Set the background color to white.
*/
+function getChildByName(container, name) {
+ for (var i = 0; i < container.children.length; i++) {
+ if (container.children[i].name === name) {
+ return container.children[i];
+ }
+ }
+ return null;
+}
var gameSettings = {};
function getGameSetting(setting) {
return gameSettings[setting];
}