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
Dostoevsky - Walk Your Own Path, Face Your Errors
In Crime and Punishment, Fyodor Dostoevsky wrote, “That’s man’s one privilege over all creation. Through error you come to the truth! I am a man because I err! You never reach any truth without making fourteen mistakes and very likely a hundred and fourte…
Introduction to real gases | Intermolecular forces and properties | AP Chemistry | Khan Academy
In several other videos, we have talked about the ideal gas law, which tells us that pressure times volume is going to be equal to the number of moles times the ideal gas constant times the temperature measured in Kelvin. Now, in all of our studies of the…
Why I’m Selling Bitcoin
What’s up Wales? It’s Megalodon here, and I have no idea why you wanted me to say that as an intro, but there you go. And now we’re about to take a bit of a twist because I’m selling some Bitcoin. It’s been an absolutely crazy ride, hitting a high of alm…
How to be a Pirate Quartermaster. 📈 💎 📈
(Recruit) So how does this work exactly? (Quartermaster) If you’d like to be a pirate, you need to understand it is a business. You can’t have a crew or a ship or a brand without a business model to support them. But pirate business is like any other. Ma…
Michael Burry Explains How to Invest (5 Key Lessons)
We bought basically short 8.4 billion of credit default swaps um related to mortgages or financial companies. You must have been pretty confident that this thing was going to blow. We had a giant bet for us, and I was extremely confident in the outcome. …
Finishing the intro lagrange multiplier example
So, in the last two videos, we were talking about this constrained optimization problem where we want to maximize a certain function on a certain set: the set of all points ( x, y ) where ( x^2 + y^2 = 1 ). We ended up working out, through some nice geom…