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
Testing a Shark Deterrent | Shark Beach with Chris Hemsworth
I think it’s fair to say, however good we get at keeping humans and sharks apart in the ocean, there will always be moments when we meet. In those worst-case scenarios when sharks bite, is there anything that can be done? Charlie Houveneers is a scientis…
What Is Consciousness?
Hey Vsauce, Michael here, and a hemispherectomy is a surgical procedure in which half of a person’s brain is removed. It’s usually only ever done on very, very young patients because their brains are still plastic enough that the remaining half will take …
Life Beyond Earth
Starring Galaxy was born out of a singularity that brought about our whole existence: the Big Bang. An isolated moment in space and time created something out of nothing. For eons, we didn’t know much about the universe, but through advancements in scienc…
My Life As an Adventure Filmmaker and Photographer (Part 3) | Nat Geo Live
Mike Libecki: This guy has completely changed my life. I met Mike in 2012. We did an expedition to Greenland. This is a picture of Mike after a trip we did when we went to China, Kyrgyzstan border. We did a big rock climb, and we lived, you know, when you…
Generating inputs and outputs of a function
So we’re asked to pick any three pairs of corresponding input and output values of the following function and fill the table accordingly, and if necessary, round our answers to the nearest 0.1. Our function is defined as: if I input a t, what I’m going t…
Are Vintage Cameras Good ASSETS To Own?
[Music] Hey everybody, this is Josh Lehrer from Lancaster, Miami, and one of the coolest parts about my job is the fascinating people that I get to meet who sometimes will just walk in off the street with something really cool. Sometimes not only is the c…