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
Samurai Sword - Linked | Explorer
NARRATOR: See this? This is a samurai, an elite Japanese warrior. And this is his sword, his samurai sword. Watch out! It’s super sharp. They’ve been around for over 1,000 years, as iconic to Japanese culture as cherry trees or Mt. Fuji. And thanks to, o…
The FASTEST Way To Pay Off Debt
What’s up guys, it’s Graham here! So we’re gonna be starting this video off with some very scary statistics. I hope you’re sitting down; you’ve been warned because this is getting out of hand. The average American is now up to thirty-eight thousand dolla…
This Little Sun Bear's World Is a Scary Place | Short Film Showcase
[Music] When the sky roars, I climb to the top. The sensation when thousands of cool drops pelt against my body, the chill sends me into a kind of giddy madness. [Music] The clouds lift. Warm rays permeate the canopy. [Music] Muddy river banks blacke…
Humanity's Greatest Journey
It’s time. Let’s reveal the 12,025 Human Era Calendar. Let’s travel back 200,000 years to humanity’s greatest journey that took our ancestors from East Africa all across the planet. With nothing on their feet and only primitive tools, they set out to cro…
Don't make the investor your customer.
These conformists are also now invading the startup world, and I agree with you. Right? The highest status job in the early-stage startup world is investor. Right? It’s the one everyone wants to meet, everyone’s talked to, everyone seeks approval from, an…
Deep concealment: searching for hidden narcotics in cars | To Catch a Smuggler
WELLE: Can you pull all the way to the front, sir? MAN: Sure. WELLE: Thank you. Right there is good. And then everybody step out and, uh, just sit over by that table over there please. Thank you. If you can think of putting something in something, you’…