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
Kevin O’Leary’s Rules for Avoiding Failure in Your 20s & 30s
The reason I invest in credit card companies is because I want some of those profits. Don’t let me profit from you; that’s crazy. I can’t make 21% in the market every year. Hi there! Chef Wonderful here again. I thought it’d be a great time of the year: …
Once You’re Rich Do This for Your Parents (Cheap to Expensive)
Did you know that by the time you’ve reached 19 years old, you would have already spent 95% of the time you’ll get with your parents in your lifetime? It doesn’t sound right, but it is true. You get your own life, your own family, your work, your passions…
What are tax forms? (Part 1) | Taxes and tax forms | Financial Literacy | Khan Academy
What we’re going to do in this video is at least to get you a little bit familiar with a bunch of forms that you’re likely to see when you get a job. I’m not going to go into deep detail on each of these forms, but just to give you some basic familiarity …
Safari Live - Day 284 | National Geographic
This program features live coverage of an African safari and may include animal kills and carcasses. Viewer discretion is advised. Hello, hello! Jambo, jambo, and a very good afternoon from the Masai Mara Triangle in Kenya! Welcome to our drive of what w…
Michael Rubin White Party 2024 | Mr. Wonderful Watches
These are the insane watches worn at Michael Rubin’s White Party. I’m here for the White Party. I got a huge CA. Obviously, I’m in white, and I got to tell you, I look spectacular! This is ridiculous, but I have no watches on. What about the puzzle on th…
8 Most Important Lessons from the 2022 Berkshire Hathaway Annual Meeting
Every year, 40,000 people travel to Omaha, Nebraska to listen to investing legends Warren Buffett and Charlie Munger speak. They share their thoughts on practically everything, from what they see going on in the stock market and in the economy, all the wa…