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
SpaceX-PLOSIONS: Why It Matters - Smarter Every Day 138
Hey, it’s me Destin. Welcome back to Smarter Every Day. Depending on where you get your media, you’re probably aware that we just failed for the third time in eight months to get cargo vehicles up to the International Space Station, which means that cargo…
BEST of MARGIN CALL #3 - First Meeting
So, Sam, what do you have for us? It’ll be here in a minute. Finding somebody in the copy room at this hour was a little bit of a challenge. Okay, let’s go right into the introductions. This is Sarah Robertson, who you know. Chief Risk Management Office…
Happiness Without Material Comfort Is Playing on Hard Mode
Even though you can certainly achieve happiness and mental health without financial health, the truth is in modern society, most of us understand that financial wealth can give us freedom. It can give us time. It can give us peace. You’re not gonna buy yo…
Jeremy Rossmann of Make School on Income Share Agreements and the Future of College
Okay, Jeremy Rossmann, welcome to the podcast! Jeremy: Glad to be here! Interviewer: You are one of the cofounders of Make School. So, for those who don’t know, what is Make School? Jeremy: Make School is a new college in San Francisco. We offer a bach…
The Declaration of Independence | Period 3: 1754-1800 | AP US History | Khan Academy
On July 4th, 1776, the delegates to the Second Continental Congress approved the Declaration of Independence, and we know parts of it very well. For example, “We hold these truths to be self-evident, that all men are created equal.” The Declaration of Ind…
3D Photographs Of Things We Have Lost
Just a few years after this photograph was taken, the quagga, a subspecies of zebra, was hunted to extinction. This is actually one of the final two photographs ever taken of the quagga; the other was taken at the exact same moment, just a few inches to t…