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
Inside Notre Dame | The Story of God
[Music] Notre Dame [Music] More than 13 million people come here every year, yet only a fraction of them knows that these vaulted ceilings house one of the most precious and closely guarded relics in all Christendom: [Music] the Crown of Thorns. I’ve bee…
Hear What Space Is Like From NASA's Most Traveled Astronaut | National Geographic
It is an incredible experience to see the details of the Earth from that vantage point and to see the Earth is uniquely suited for life. I think I’ve been on orbit with over 50 different people. If you counted them all up, the very unique views of what y…
Rebellion | Vocabulary | Khan Academy
Sound the drums of war, wordsmiths, because today I teach you about rebellion. Man, I’m a great influence! It’s a noun; it means war or pushback against a government or an authority, right? The American Revolutionary War began as a rebellion against the …
Using the tangent angle addition identity | Trigonometry | Precalculus | Khan Academy
In this video, we’re going to try to compute what tangent of 13 pi over 12 is without using a calculator. But I will give you a few hints. First of all, you can rewrite tangent of 13 pi over 12 as tangent of… instead of 13 pi over 12, we can express that…
Apple Stock Splits 4-for-1. What does it mean for investors?
This video is sponsored by Stake. Download the Stake app today and use the referral code AWC to receive a free stock when you fund your account. Details in the description. Well, during Apple’s Q3 earnings results released on Thursday, over in the United…
Tuna Gremlin | Wicked Tuna
Yo, there he is on the down! Rod, oh my God, got him on! Got him on, get him on, get up there! Got him on, wo! Come off on the bite. Oh dude, what happened that time? There’s no weight, no nothing. I don’t know—we’re at the bottom of the fleet, and we’re…