[COLOR=#000000][FONT=Arial]I want to make a button where once the button is clicked it changes a dynamic text field from 100 to 0, and if clicked again from 0 to 100. When I exit the game, I want it to save what the user’s last number was. If he exited with a “0” I want a 0 to show up the next time the user opens the game. I have made the following code:[/FONT][/COLOR]
import flash.events.MouseEvent;import flash.media.SoundChannel;
import flash.ui.Mouse;
var onoff:Number;
onoff = 100
options_mc.onoff_txt.text = String(onoff);
options_mc.sound_btn.addEventListener(MouseEvent.CLICK, mute);
options_mc.test3.addEventListener(MouseEvent.CLICK, test3);
function mute(event:MouseEvent)
{
var so:SharedObject = SharedObject.getLocal("options");
if(so.data.onoff == 100)
{
so.data.onoff = 0
options_mc.onoff_txt.text = String(onoff);
so.flush();
}
else if(so.data.onoff == 0)
{
so.data.onoff = 100
options_mc.onoff_txt.text = String(onoff);
so.flush();
}
}
function test3(event:MouseEvent)
{
var introTween = new Tween(startMenu,"x",Strong.easeInOut,startMenu.x,(startMenu.width)*.5,1,true);
startMenu.visible = true;
}
[COLOR=#000000][FONT=Arial]My problem with this code is that it’s not changing the text field when the button is clicked! Could you please help on what I have done wrong?[/FONT][/COLOR]