punky79
04-01-2008, 11:21 AM
I have created a variable called “pressed” and assigned it to “false”
var pressed;
pressed = false;
When audio off button is pressed the audio is turned off and the text box visability is turned to true. I then set “pressed” to “true”.
on (release){
pressed = true;
x.stop();
var p;
p = Math.floor(x.position/1000);
my_text._visible = true;
}
When audio on button is pressed the audio is started and the text box visability is turned to false.
on (release){
pressed = false;
x.stop();
x.start(p,0)
my_text._visible = false;}
On scene 2 I then check to see if pressed is equal to false or true to either start or stop the new sound….
if (pressed = false){
x.stop();
var x = new Sound();
x.attachSound("2");
x.start(0,0);
}
else if (pressed = true){
x.stop();
}
Or make the text box visable or invisible…….
if (pressed = false){
my_text._visible = false;
loadVariables("DOF 2.txt", this);
}
else if (pressed = true){
my_text._visible = true;
loadVariables("DOF 2.txt", this);
}
But it does not work……
When I check the variable pressed in scene 1 it works correctly between true and false but when I move to scene 2 the variable changes to “true” even if I have not clicked audio off button????
Can anyone help???
Thanks J
var pressed;
pressed = false;
When audio off button is pressed the audio is turned off and the text box visability is turned to true. I then set “pressed” to “true”.
on (release){
pressed = true;
x.stop();
var p;
p = Math.floor(x.position/1000);
my_text._visible = true;
}
When audio on button is pressed the audio is started and the text box visability is turned to false.
on (release){
pressed = false;
x.stop();
x.start(p,0)
my_text._visible = false;}
On scene 2 I then check to see if pressed is equal to false or true to either start or stop the new sound….
if (pressed = false){
x.stop();
var x = new Sound();
x.attachSound("2");
x.start(0,0);
}
else if (pressed = true){
x.stop();
}
Or make the text box visable or invisible…….
if (pressed = false){
my_text._visible = false;
loadVariables("DOF 2.txt", this);
}
else if (pressed = true){
my_text._visible = true;
loadVariables("DOF 2.txt", this);
}
But it does not work……
When I check the variable pressed in scene 1 it works correctly between true and false but when I move to scene 2 the variable changes to “true” even if I have not clicked audio off button????
Can anyone help???
Thanks J