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
I f***ed up by not buying this house (the one that got away)
And here I am. I would have been able to either buy it at ninety-six thousand dollars and get free insurance money to fix it up, or I could renegotiate the price, taking it as is, fix it up myself, and probably made, right there, just easily, just right t…
More on Newton's third law | Forces and Newton's laws of motion | Physics | Khan Academy
We should talk a little more about Newton’s third law because there are some deep misconceptions that many people have about this law. It seems simple, but it’s not nearly as simple as you might think. So, people often phrase it as, “For every action, th…
Finding zeros of polynomials (example 2) | Mathematics III | High School Math | Khan Academy
So I have the polynomial ( p(x) ) here, and ( p(x) ) is being expressed as a fourth degree polynomial times ( (3x - 8)^2 ). So this would actually give you some, this would give you ( 9x^2 ) and a bunch of other stuff, and then you multiply that times thi…
This Guy Is Making Furniture and Buildings out of Your Trash | Nat Geo Live
[Arthur] I hate plastic. That’s why we’ve engulfed on a 15 year mission to turn that into something that we actually want. We have collected around 750 new materials that’s coming from our daily post-consumer waste. It can go into any consumer product a…
Demolishing My House
What’s up you guys, it’s Graham here! So first off, let me just start by saying I was blown away by how many people wanted an update from the aftermath after my tenants moved out. I don’t think I have ever received so many comments from everyone, all aski…
Catalysts | Reaction rates and equilibrium | High school chemistry | Khan Academy
In this video we’re going to talk a little bit about catalysts. So let’s first imagine that we have two reactants, and I’m going to simplify things with these overly simplified drawings. So let’s say you have this reactant right over here, and I’m drawin…