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
Rediscovering Youth on the Colorado River | Short Film Showcase
[Music] When I was born in the summer of ‘86, my dad wrote me these words: “The important places, child of mine, come as you grow. In youth you will learn the secret places: the cave behind the waterfall, the arms of the oak that hold you high, the stars…
15 Signs You’re Pre-Rich
Some of you aren’t broke, right? You’re just on the way to becoming rich. Let’s call you pre-rich. Your time hasn’t come yet, but you might share some of these early signs that one day, probably soon, your reality will match your potential. Here are 15 si…
Average velocity and speed worked example | One-dimensional motion | AP Physics 1 | Khan Academy
We are told a pig runs rightward 20 meters to eat a juicy apple. It then walks leftward 5 meters to eat a nut. Finally, it walks leftward another 25 meters to eat another nut. The total time taken by the pig was 300 seconds. What was the pig’s average vel…
360° Dangerous Honey Hunting (4K) | Explorer | National Geographic
You’re getting it! I’m trying. You got there by the tree, so for the honey, okay? Never in my wildest dreams did I think I’d be here. Our second day of 4x4 Jeep Eng, just trying to get a few styling shots. My first assignment, so it’s a lot of pressure. …
String Theory Explained – What is The True Nature of Reality?
What is the true nature of the universe? To answer this question, humans come up with stories to describe the world. We test our stories and learn what to keep and what to throw away. But the more we learn, the more complicated and weird our stories becom…
See the Sparks That Set Off Violence in Charlottesville | National Geographic
The point of the rally is to, number one, protect this statue because this statue is one of many statues that are in honor of the history of Western civilization and European peoples that are being torn down. [Applause] The policies that liberals have put…