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
We Need to Rethink Exercise (Updated Version)
Losing weight is hard, and unfortunately, your body is sabotaging you every step of the way. Your body is a biological machine that follows the laws of thermodynamics and needs energy and raw materials to stay alive, which is why you eat. The energy from …
Post-Truth: Why Facts Don't Matter Anymore
This is the challenge of a YouTuber, which is, you know, pushing the record button and actually filming something. Because you never know: “Are people going to hate it?” Or “Is it good enough?” Have you thought through what you’re going to say. I’ve not t…
10 Things I Wish I Knew Before I Started Stock Market Investing (How to Invest in 2023)
So I’ve seen these videos pop up with video games, right? “10 Things I Wish I Knew Before Playing Starfield” or “World of Warcraft” or whatever, and it sparked a bit of an idea. Now that I’ve been investing in the stock market for, you know, a little whil…
Climb Ancient Temples in Belize's Maya Ruins | National Geographic
Coming up now at the top of the observatory, I need to catch my breath. I’m Marie McCrory with National Geographic Travel. Belize is home to about a dozen major Mayan ruins, which are visited by over 300,000 tourists every year. But the largest Mayan site…
Watermelon vs Potato in Slow Motion - Smarter Every Day 155
Hey, it’s me, Destin. Welcome back to Smarter Every Day. I have built a potato gun out of clear pipe, which is amazing because you can see what’s going on on the inside of the potato gun. Today’s experiment is going to be pretty fun. Please excuse my scra…
Safari Live - Day 166 | National Geographic
This program features live coverage of an African safari and may include animal kills and carcasses. Viewer discretion is advised. Good afternoon, good afternoon ladies and gentlemen, and a very warm welcome to you again here on Safari Live. We are on a …