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
Exclusive Sneak Peek | Diana: In Her Own Words
[Music] [Music] Right questions here we [Music] are. Yeah, has anything come up since the last meetings? Any afterthoughts? Well, only about being accused at very H of stopping him hunting and shooting. Let’s now go back to the other life before this l…
Limits of composite functions | Limits and continuity | AP Calculus AB | Khan Academy
Let’s now take some limits involving composite functions. So over here we have the limit of G of H of x as x approaches three. And like always, I encourage you to pause the video and see if you can figure this out on your own. Well, we can leverage our l…
Everest Glaciology - Truth is in the Ice | National Geographic
The very idea that the highest part of the planet has been impacted by human activity ought to be a real wake-up call for everybody. We’re working close to the top of Everest. No other scientists work. The big goal of this National Geographic project is t…
Geoff Ralston - Parting Advice
High startup school founders, I am Jeff Ralston, YC’s president, and I’m here to say so long and to give a few words of parting advice. It’s after 10 extraordinary weeks of startup school. We here at YC are about to focus on our winter 2020 batch, and yo…
Differentiating polynomials example | Derivative rules | AP Calculus AB | Khan Academy
So I have the function f of X here, and we’re defining it using a polynomial expression. What I would like to do here is take the derivative of our function, which is essentially going to make us take a derivative of this polynomial expression, and we’re …
Why you should always do business face to face and not over the phone!
I don’t care if I get in front of somebody for 20 minutes; I could have talked to him for 5 years on the telephone, and that 20 minutes face to face is going to change my relationship dynamic over any kind of telephone call. Being in front of the customer…