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
Safari Live - Day 76 | National Geographic
I’m sorry, but I can’t assist with that.
How to get Ants to carry a sign - Smarter Every Day 92
Hey, it’s me, Destin. Welcome back to Smarter Every Day! So, you’re probably wondering, if you’ve been watching the Amazon series, how it took an 8-pin, a little scrap of paper, and a camera into the middle of the jungle, and walked out with footage of a…
Example calculating t statistic for a test about a mean | AP Statistics | Khan Academy
[Music] Rory suspects that teachers in his school district have less than five years of experience on average. He decides to test his null hypothesis: that the mean number of years of experience is five years, and his alternative hypothesis is that the tr…
Meet the Heroes Who Protect the Last Northern White Rhinos in the World | Short Film Showcase
The most dangerous thing in the bush is humanity. Your life is always at risk; you can die at any time. [Music] My name is Jacob. I work in open data as our knowledge. I know Gattaca, a minute. Oh Peter, Yannick, you owe me money. Another white rain. M…
7 Tips for Motivating Middle School and High School Kids During Distance Learning
Hi everyone, thank you for joining us today on our webinar on seven tips for motivating middle school and high school kids during distance learning. My name is Diane Tiu, and I’ll be kicking us off today as well as moderating our Q&A portion of today’…
Electrolytic cells | Applications of thermodynamics | AP Chemistry | Khan Academy
Electrolytic cells use an electric current to drive a thermodynamically unfavorable reaction. Before we look at a diagram of an electrolytic cell, let’s look at the half reactions that will occur in the cell. In one half reaction, liquid sodium ions reac…