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
Why Are Things Creepy?
Hey, Vsauce. Michael here. Fear gives us life. Being afraid of the right things kept our ancestors alive. It makes sense to be afraid of poisonous insects or hungry tigers, but what about fear when there is no clear and obvious danger? For instance, a Ted…
Responding To CRINGE Investment Advice | BEST and WORST
What’s up you guys? It’s Graham here. So, I would like to think of myself as being social media savvy. You know, I got a YouTube channel. I got an Instagram account that I post on every now and then. I even have a Facebook group that I browse every single…
Limitless with Chris Hemsworth | Official Trailer | Disney+
(Wind blowing) - You’re probably asking yourself why I’m dangling off a rope a thousand feet off the ground. I’m asking the same question. Well, Disney wanted to make a show about longevity. Turns out this has something to do with it. Here we go. (Dramat…
Howard Marks: The BIGGEST Investment Opportunity in 40 Years
53 years in your investing career, there have been three sea changes, and we are in one of them. What does that mean? Howard Marks, he is a billionaire and one of the most highly respected investors in the world. Marks has been investing for over 50 years…
I Was SCARED To Say This To NASA... (But I said it anyway) - Smarter Every Day 293
All right, so I am a PhD student at The University of Alabama in Huntsville. There’s a lot that goes into that. It’s a very difficult thing for me. I’m studying under Dr. Jason Cassibry. Really fun. The other day, someone from the university reaches out a…
How much money I made from 1M views- How to make money on Youtube
You probably saw YouTubers buying luxury cars, designer clothing, and expensive houses. And I’m pretty sure that you have at least for once wondered how much do these YouTubers make. So in this video, I’m gonna show you exact data of how much money I made…