yego.me
💡 Stop wasting time. Read Youtube instead of watch. Download Chrome Extension

Flash Actionscript Tutorial 2 - If Statements


2m read
·Nov 3, 2024

Processing might take a few minutes. Refresh later.

Hey guys, this is Maaz1. Today I'm going to be doing a flash action script tutorial number two. It's a follow-up of tutorial number one.

So I'm going to be teaching you how to make a button to toggle playing and pausing for an animation. This is going to be one button, unlike the first tutorial, which had two buttons.

First of all, you're going to want to make a button. Make a new layer. On the new layer, draw a button, select it, and convert it to a symbol. The type should be button, registration should be center.

What you want to do is go into properties. Right? I'm going to name my button "toggle button." Then you're going to want to open up the actions of the layer. Do this by right-clicking on the frame.

You're going to want to set up a variable: var u Boolean = true. The Boolean type of variable means true or false. So then, you're going to put the if statement inside of an on release.

You're going to do toggle button on release = function() {. Open the curly brace. Then you're going to do if Fu, which implies if Fu equals true. But you don't have to; you can omit that.

Then root.stop(), and then root.Fu = false. So, what "root" means is that it goes—the root is the main timeline, which is what you're looking at right here. If it's inside of a button or a movie clip, you want to specify root so that it does it from the main timeline and not from the movie clip or button.

So then you want to do else {. Open the curly brace. root.play(), and root.Fu = true.

So now, if we test this, we press the button, and it pauses. Then we can press the button again, and it plays.

So, thanks for watching! M cu one, subscribe and goodbye!

More Articles

View All
Elemental building blocks of biological molecules | Chemistry of life | AP Biology | Khan Academy
What we have here is just a small sample of the types of molecules that you will see in a biological system. At the top left, right over here, you have an example of an amino acid. Amino acids are the building blocks of proteins. If we were to take a look…
Plastic Pollution: How Humans are Turning the World into Plastic
When the gods granted king Midas one wish, he wished that everything he touched would turn to gold. Midas was delighted. Trees, rocks, buildings— all gold. But soon he found in horror that his food turned into gold as well. When he hugged his daughter to …
The Philosopher of Pleasure | EPICURUS
Pleasure is the first good. It is the beginning of every choice and every aversion. It is the absence of pain in the body and of troubles in the soul. Epicurus. In the third century BC on the Greek island of Samos, a man was born that would become the fo…
The Most Terrifying Thought Experiment: Roko's Basilisk
If you knew you’d be subjected to eternal torture because you didn’t do something, you’d do it right. What if that something was aiding in the development of super intelligent AI? Would you still step up and help? The question is presented in one of the m…
Life Below the Ocean Surface | StarTalk
So you know that’s a fish. Oh, that’s cool. He’s cute, or she. You can’t even tell. But what is that fish thinking? Is it like— is it nostalgia? Is it rage? Maybe I’m just projecting. But you can’t really tell what it’s thinking. It’s a mystery. It’s an e…
WORLD’S MOST AMAZING ARCHER in Slow Motion - Smarter Every Day 130
Hey it’s me Destin, welcome back to Smarter Every Day. I know when you think about archery you think about Nottingham, and one guy in particular, Robin Hood. But I’m gonna tell you about a guy today in my home town that might even be better than Robin Hoo…