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
The Last Northern White Rhinos | Years of Living Dangerously
That’s right. It’s good we met the last three northern white rhinos in existence. They have three armed guards that follow them around and make sure the poachers don’t kill them, so they have to have 24-hour security. Yes. Do you think people will come i…
How Bacteria Rule Over Your Body – The Microbiome
Microbes are everywhere, on your phone, in your water bottle, on your hands before you wash them, on your hands after you wash them, and literally everywhere else on top of you too. Microbes are omnipresent at any moment, and there is nothing we can do ab…
TikTok Is Causing A Mass Psychosis
[Music] In June 2019, Kirsten Muellerval, a psychiatrist at Hanover Medical School and head of its Tourette’s outpatient department, noticed unusual symptoms in her new set of patients. To begin with, all of them were teenagers, and they were suffering fr…
TikTok Is More Dangerous Than We Thought
Tick Tock is far more dangerous than we thought. In the past two years, at least 15 kids age 12 or younger, across the globe, from Milwaukee to Sicily, have painfully passed on after attempting what seemed to them like harmless challenges they found on th…
Elon Musk $5 million donation to Khan Academy thank you
Hi everyone, Sal Khan here from Khan Academy, and I just wanted to give a huge shout out and thank you to Elon Musk and everyone at the Musk Foundation for their incredibly generous support for Khan Academy. They just recently gave a 5 million dollar don…
TIL: You Can Smell Through Your Skin | Today I Learned
[Music] Your nose isn’t the only thing that can smell things. You can smell through your skin, and that was a big surprise on one of our expeditions. I dive into a lot of these underwater caves, what we call blue holes. Maybe at about 30 ft, you hit these…