Hi guys! bit of action script troubles:
what i want to happen:
a movie clip react once to a mouse click, but the any click after the first will get no response.in the first frame of the main timeline i declare a variable:
var counter = 0;
on release i check to see if counter = 0
if counter = 0 the code is executed and i add one to the variable counter
counter++;
so that the next time there is a click the if loop is false and nothing happens.
except it dosent work, not even the first click gets a response. so i tried declaring a global variable in another situation, which also didnt work: what i want to happen is on release check if the light is on if its on then turn it off if the light is off then turn it on.
in the first frame of the main timeline i put
_global.lightson = true;
then on the movieclip of the light, which is also on the main timeline i put the code
on (release) {
if(lightson=true){
setProperty(lights,_alpha,0);
_global.lightson=false;
}else if (lightson=false){
setProperty(lights,_alpha,100);
_global.lightson=true;
}
}
if anyone could help me out with the coding i'd really appreciate it!!!
Kitten ^_-
what i want to happen:
a movie clip react once to a mouse click, but the any click after the first will get no response.in the first frame of the main timeline i declare a variable:
var counter = 0;
on release i check to see if counter = 0
if counter = 0 the code is executed and i add one to the variable counter
counter++;
so that the next time there is a click the if loop is false and nothing happens.
except it dosent work, not even the first click gets a response. so i tried declaring a global variable in another situation, which also didnt work: what i want to happen is on release check if the light is on if its on then turn it off if the light is off then turn it on.
in the first frame of the main timeline i put
_global.lightson = true;
then on the movieclip of the light, which is also on the main timeline i put the code
on (release) {
if(lightson=true){
setProperty(lights,_alpha,0);
_global.lightson=false;
}else if (lightson=false){
setProperty(lights,_alpha,100);
_global.lightson=true;
}
}
if anyone could help me out with the coding i'd really appreciate it!!!
Kitten ^_-