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
TRUMP JUST STORMED WALL STREET
What’s up, grab it’s guys here. So, normally I don’t make videos like this, and I tend to stay away from anything involving politics. But today we gotta talk about one of the most requested topics of investing that stands to make or lose people a lot of m…
The Index Fund Problem Looming in 2024
I told you not to sell. I worry about it. A good.com. Do you happen to own index funds in your portfolio? Maybe SPY from State Street or VO from Vanguard or IVV from Black Rock? All these ETFs track the S&P 500, which is an index composed of the large…
Should Airships Make A Comeback?
Airships seem like a bad idea. Exhibit A. (bright upbeat music) It’s the greatest of miracles that anyone came out of the disaster alive. The Hindenberg was filled with over 200 million liters of hydrogen, but it also had an iron oxide and aluminum powd…
The Housing Market Bubble Just Popped
What’s up you guys, it’s Graham here! So we have to talk about what’s going on with the housing market because it was just found out that prices are continuing to go higher. Wait, what? Yep, you heard that correctly! Even though housing starts have dropp…
ABC 20/20 says Kevin O'Leary is a Bosshole!
Well, how’s this for a greeting? Welcome to hell! You just met the devil, and that’s the friendly version from Shark Tank’s Kevin O’Leary. You know the one with a big mouth, big opinions, and very big success. So is the only way to get ahead by leaving a …
Science Fiction Inspires the Future of Science | National Geographic
The wonders of the future, the marvels of the presence. Science fiction and science innovation have been intertwined since sci-fi’s origins. From video chat to self-driving cars to space flight, there’s the science fiction and the science reality. Sci-fi …