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
Part to whole ratio word problem using tables
We’re told that one month the ratio of indoor to outdoor play times for Yusuf’s class was two to three. They had 30 total play times. How many of the play times were indoors? How many were outdoors? Pause this video and see if you can figure that out. A…
Pronoun-antecedent agreement | Syntax | Khan Academy
Hello grammarians! Hello visiting cousin Beth! Hello cousin David! So today, we’re going to be talking about pronoun antecedent agreement. And what is that? So an antecedent is a thing that goes before. So ‘ante’ means before and ‘seedent’ is like a goin…
Why Stocks are Crashing | The 2022 Stock Market Crash Explained
The stock market is off to its worst start in a year since 1939. Yeah, you heard that right. As of the making of this video, the stock market hasn’t fallen this much to start a year in 83 long years. The fall of the stock market has resulted in trillions …
Dividing whole numbers by 10 | Math | 4th grade | Khan Academy
Dividing by 10, a lot like multiplying by 10, creates a pattern with numbers. So let’s dig in and look at dividing by 10. Look at what happens when we divide by 10 and see if we can figure out that pattern and maybe even how it relates to the pattern for …
Bill Ackman's NEXT Billion Dollar Bet
Billionaire investor Bill Ackman has the power to move markets with what he says. Unlike most investors, he rarely buys and sells stocks. That is why it is a big event when Bill Ackman announces a new investment he has made within his closely followed Per…
RECESSION ALERT: The 5 BEST Index Funds To Buy ASAP
What’s up, Graham? It’s guys here. So, I’ve noticed that people love to over complicate investing. Just buy into money puts expiring on May 12th over here, March in your portfolio. When the Fibonacci sequence falls below the 369-day moving average, you’ll…