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
Jack Bogle: Beware of This One Mistake 99% of Investors Make
At least start off. I mean, I’d say start off an index fund period. And for five years, don’t do anything else and then look around and see what’s happened in the five years. See how it felt when the market dropped fifty percent. See how it felt when it c…
The Excavation of Tutankhamun’s Mummy | King Tut in Color
NARRATOR: At last, in October 19, 2005, after three years of excavating Tutankhamun’s tomb, Howard Carter and his team begin to open the king’s coffin. Lifting its lid exposes another shroud. When Carter carefully peels that back, he discovers a second gi…
The upcoming economic crisis? | Stagflation explained
There is a really ugly word that is beginning to be thrown around for the first time in nearly 50 years. The last time the US economy experienced the devastating impacts of this word was way back in the 1970s, a period of time when inflation had a stagger…
Filming the Alaskan Wilds - Behind the Scenes | Life Below Zero
We are here to document the lives of people living in Alaska. The harsh reality is the environment we’re up against; it makes it tough to do our job. They’re working on Life Below Zero, and it can be very dangerous—guns here, cameras here—you never know w…
How Does a Transistor Work?
In this phone, there are nearly 100 million transistors; in this computer, there’s over a billion. The transistor is in virtually every electronic device we use: TVs, radios, Tamagotchis. But how does it work? Well, the basic principle is actually incredi…
Local linearization
[Voiceover] In the last couple videos, I showed how you can take a function, ah, just a function with two inputs, and find the tangent plane to its graph. The way that you think about this, you first find a point, some kind of input point, which is, you k…