Last active
August 2, 2017 04:41
-
-
Save dhollaway/8035c406482e5293af2be5e7f856fd20 to your computer and use it in GitHub Desktop.
Shared Object Problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//******************************* In the Settings class | |
private function loadButtons():void | |
{ | |
//Background sound | |
if(StatsMain.g_status_bgSoundON == true) | |
{ | |
_BackgroudSoundON.visible = true; | |
_BackgroudSoundOFF.visible = false; | |
} | |
else | |
{ | |
_BackgroudSoundON.visible = false; | |
_BackgroudSoundOFF.visible = true; | |
//GameSoundManager.bgSounds_Group.mute = true;//sound is on. | |
} | |
} | |
//Settings click. When the sound is turned off. | |
private function turnOFF_BackgroundMusic():void | |
{ | |
//OFF button is now showing | |
//GameSoundManager.bgSounds_Group.mute = true; | |
_BackgroudSoundOFF.visible = true; | |
_BackgroudSoundON.visible = false; | |
StatsMain.g_status_bgSoundON = false; | |
//Sets the status of the sound | |
//StatsMain.gameSharedObject.data.bgSoundisOFF = true; | |
//StatsMain.gameSharedObject.data.bgSoundisON = false; | |
//Save the sound setting | |
StatsMain.saveSharedObject(); | |
trace("SceneSettings>turnOFF_BackgroundMusic(): The background sound is: " +StatsMain.g_status_bgSoundON); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//******************************* In the StatsMain class | |
public static var g_status_bgSoundON:Boolean; | |
if (!gameSharedObject.data.bgSoundisON) | |
{ | |
gameSharedObject.data.bgSoundisON = true; | |
//GameSoundManager.bgSounds_Group.mute = false; | |
} | |
//Sound | |
g_status_bgSoundON = gameSharedObject.data.bgSoundisON; | |
public static function saveSharedObject():void | |
{ | |
gameSharedObject.data.totalGlobalScore = g_TotalScore; | |
gameSharedObject.data.totalProblemsCorrect = g_TotalProblemsCorrect; | |
gameSharedObject.data.totalProblems = g_TotalProblems; | |
gameSharedObject.data.bonusPoints = g_BonusPoints; | |
gameSharedObject.data.bgSoundisON = g_status_bgSoundON; | |
gameSharedObject.data.fxSoundisON = g_status_fxSoundON; | |
gameSharedObject.flush (); | |
trace("StatsMain: All objects have been flushed!"); | |
trace("StatsMain: The variable for bg sound is: " +g_status_bgSoundON); | |
trace("StatsMain: The Shared Object for bg sound is: " +gameSharedObject.data.bgSoundisON); | |
/*trace("STATS MAIN [START]********************************************************"); | |
trace("The flush statement has excuted!"); | |
trace("Status of the bgSoundisON: " +gameSharedObject.data.bgSoundisON); | |
trace("-----------------------------------------------------------"); | |
trace("STATS MAIN [END]**********************************************************");*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment