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
Stolen Mummy's Left Hand Found and Returned to Egypt | National Geographic
We have a repatriation of ancient artifacts from Egypt. It includes a child sarcophagus about 2,600 years old, the top of another mummy sarcophagus, a burial shroud from inside a mummy sarcophagus, and finally, there is a mummified hand which was collecte…
Solo Trip | Life Below Zero
[Music] My name is Martha May Salatan. I’m married to Eric Salatan. I’m from Ilama, Alaska, was born and raised here. I enjoy hunting, fishing, camping—anything that has to do with the outdoors. Beautiful day to go play on the lake, see if I can’t find so…
overstimulation is ruining your life
Imagine being on a sinking ship, and instead of trying to save yourself, you’re scrolling through a never-ending feed of memes and gossips. That exactly reflects what’s happening in our lives; we are drowning in a sea of overstimulation and digital distra…
WHAT JUST HAPPENED WITH YOUR STIMULUS CHECK
What’s up, Graham? It’s guys here, so I’m sure we all know this saying: whatever can happen will happen. As much as we thought it was a sure thing that the Senate would pass some sort of stimulus package before they left for recess on August 7th, they wer…
Grand Canyon Adventure: The 750-Mile Hike That Nearly Killed Us (Part 1) | Nat Geo Live
What we’re gonna do tonight, Kevin and I are gonna take you on an unusual and somewhat remarkable journey through a remarkable place, the Grand Canyon. But before we do that, we felt it’s important to get a little bit of an idea of how we know each other,…
How to Escape from a Car Window (SLOW MOTION) - Smarter Every Day 144
Hey, it’s me Destin. Welcome back to Smarter Every Day. Have you ever been driving along and you suddenly stop and realize that you’re moving around this world in a bubble of glass? It’s kind of weird if you think about it. But it’s really cool. Engineer…