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
Ideology and social policy | US government and civics | Khan Academy
In this off-white color, I have a handful of statements that you might hear folks say, especially in the United States. What we’re going to think about is, are these statements that you would typically hear from a liberal? I’m gonna make a little key here…
It Started: Car Prices Are Falling 50%
What’s up, Grandma’s guys here! And it’s official: after seemingly unstoppable growth, the used car market has begun to collapse. A new report from Black Book just found that subcompact car prices have declined 3.68% in just the last week alone. As wholes…
How To Save $10,000 FAST
What’s up, guys? It’s Graham here. And let’s face it, we’re in trouble. It’s recently reported that African-American only saves five percent of their income. The median savings for those under 33 years old is just three thousand two hundred and forty doll…
Volumes of cones intuition | Solid geometry | High school geometry | Khan Academy
So I have two different three-dimensional figures here. I have a pyramid here on the left, and I have a cone here on the right. We know a few things about these two figures. First of all, they have the exact same height. So this length right over here is…
When being alone is a choice... (personal journey)
When someone spends more time in solitude than is considered normal, then people begin to worry. What’s going on with this person? Is he doing okay? Is she depressed? And so we tell them to get out there, meet people, and connect. “Humans are social anima…
Travis Kalanick at Startup School 2012
Wow, this is awesome! Okay, this place is full. All right, so good to meet all of you. My name is Travis Kalanick, co-founder and CEO of Uber. Let’s see, so I do a lot of speaking because we are a technology company that is, we’re in the trenches, we’re …