No, because now you are always setting the number variable to 1 when you release the button. Don't give it a default value at all, let the if statement do that. Since Flash considers 0 as false and 1 as true in an if statement if the variable as no set value it will automatically be determined as false.
Also I just noticed another problem I didn't catch before (might I add... your text is too dark to read well, I recommend changing it) is that you are checking the value of number wrong. When comparing the value of one thing to the value of another you use "==", using just "=" is to set the value of a variable to something.
== is to compare
= is to set
So it would be if(number == 0)
And last put not least, since 0 and 1 are false and true (respectively) you can use the shorter method where just using the variable name checks if it is true and using the variable name prefixed by a "!" means it is false...
variableName = true
!variableName = false
So with that said... try something like this...
on (release){
//if the paused variable is false or non-existant
if (!paused){
//stop the movie
loader.stop();
//set paused variable to true
paused = true;
} else {
//else if paused variable is true
//play movie
loader.play();
//set paused variable to false
paused = false;
}
}
- on (release){
- //if the paused variable is false or non-existant
- if (!paused){
- //stop the movie
- loader.stop();
- //set paused variable to true
- paused = true;
- } else {
- //else if paused variable is true
- //play movie
- loader.play();
- //set paused variable to false
- paused = false;
- }
- }
I used "paused" as the variable name for two reasons... first it makes sense given the situation you are in... and the second is to prevent confusing flash with the Number() command (although I doubt it would, but better safe than sorry, you shouldn't really ever use preset flash commands as variable names)
And I also used true and false over 0 and 1 because to me it is just easier to read that way.