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
This Black Hole Could be Bigger Than The Universe
We proudly present to you: The kurzgesagt Guide to Curiosity. Join us on an interactive adventure across 160 thrilling pages that will change your perspective on the world forever. Available now on the kurzgesagt shop. You might be inside a black hole th…
Lesson Planning with Khanmigo
This is Conmigo, an AI-powered guide designed to help all students learn. Kanmigo is not just for students; teachers can use Conmigo too by toggling from student mode to teacher mode. Once in teacher mode, Conmigo transforms into the teaching assistant yo…
How to Fight Fire or Flooding on a Nuclear Submarine - Smarter Every Day 244
Hey, it’s me, Destin. Welcome back to Smarter Every Day. Earlier this year, I had an amazing opportunity to board a U.S. Navy nuclear submarine on an ice flow in the Arctic. This is the next video in a Smarter Every Day deep dive series into submarines an…
15 Signs You Have A Rich Life
Are you living the life you’ve always dreamed of? Do you wake up each morning feeling grateful and fulfilled? If not, it’s time to assess if you’re truly living a rich life. But what exactly is a rich life? Is it measured by wealth and material possession…
Curvature formula, part 1
So, in the last video, I talked about curvature and the radius of curvature. I described it purely geometrically, where I’m saying you imagine driving along a certain road. Your steering wheel locks, and you’re wondering what the radius of the circle that…
Analyzing Billions of Transactions to Understand Consumer Behavior - Michael Babineau and Kevin Hale
Mike: Kevin was a group partner when you did YC in the summer 2015 batch. What idea did you apply with? Kevin: Our basic idea at the time was really to use credit card data to help investors make better investment decisions. I think one thing that is act…