First convert something to a button. I hope you know how. Go into its actions, and enter whatever code you want.
Buttons use mouse events, which look like so:
- Code: Select all
on (something) {
whatever you want to happen here
}
The something can be many things, like press. Press will do the action specific as soon as you click the button.
Release. As soon as you release the button.
On keypress. For example, on (keypress(LEFT)) would do the action when you press left.
Etc, etc.
Now, for the action! A bit harder now. I'll start out simple.
- Code: Select all
on (press) {
gotoAndPlay (3)
}
Will go to the 3rd frame when pressed. Or, try variables:
- Code: Select all
on (press) {
score=1
}
I hope for your sake you can figure that out. Multiple actions time.
- Code: Select all
on (release) {
if (_quality == "LOW") {
_quality = "MEDIUM";
} else if (_quality == "MEDIUM") {
_quality = "HIGH";
} else if (_quality == "HIGH") {
_quality = "LOW";
}
}
You don't have to understand that all right now, but it shows that you can make as many things as you want happen from the same button.
But, I'll go in depth on the code anyway.
- Code: Select all
on (release) {
Simple part.
- Code: Select all
if (_quality == "LOW") {
_quality = "MEDIUM";
If the quality was lowed before you released it (that's what == is for) the new quality is medium.
- Code: Select all
on (release) {
if (_quality == "LOW") {
_quality = "MEDIUM";
} else if (_quality == "MEDIUM") {
_quality = "HIGH";
} else if (_quality == "HIGH") {
_quality = "LOW";
}
}
Note how each bracket has an open { and a closed }. That begins and ends each statement. Make sure they are placed correctly, and there are enough! And yes, that quality code will really work!

