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
Divergence formula, part 1
Hello everyone. So, now that we have an intuition for what divergence is trying to represent, let’s start actually drilling in on a formula. The first thing I want to do is just limit our perspective to functions that only have an x component, or rather w…
These Two Young Bushmen Hope for a New Life in the Modern World | Short Film Showcase
[Music] Love h h h h my oh my. [Music] Fo I [Music] [Music] note foree. [Music] Spee [Music] when I go through new, I see a lot of hopeless faces. People who are here, we are undergoing a lot of change, and we are losing our way of life. Foree [Music] if …
Balaji Srinivasan at Startup School 2013
I can talk about white combinator. I guess you guys all know about that. Uh, let me introduce myself briefly while, uh, things are loading here. So, uh, my name is Bology S. Boson. Um, there’s actually 12 people with my same first and last name in the Bay…
15 Personal Finance Lessons Everyone Wishes They Knew Sooner
You know how they say it’s never too late? Well, that’s not entirely true, right? Sometimes it is too late, and you do not want to be that person who has that kind of realization. A survey by Bankrate found that 57% of people in the US feel behind on thei…
Forget Scarecrows—Falcons Protect This Farm | National Geographic
We’re kind of like security guards. We arrived before the sugar content of the fruit starts going up. As the foods ripen, the birds are more and more attracted to it, so we stand guard ten hours a day in that field until basically the fruit is harvested. …
Ancient Life as Old as the Universe
Life has existed on one planet for about 4 billion years, as far as we know. But it might have started right after the Big Bang, when the universe was much stranger and more fantastic than today. A universe that might have allowed life to develop absolute…