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
I was TERRIFIED to film this - how to take action!
What’s up you guys? It’s Graham here. So, I’m making this video as a part two to the video I uploaded about two weeks ago about how to get over your fear. On that video, I received this amazing comment from the user named Tristan. Tristan explained that …
Reading (and comparing) multiple books | Reading | Khan Academy
Hello readers! You know what’s better than reading a book? Reading two books! Reading a bunch of books! Reading a mountain of books! This may sound self-evident, but great readers read a lot of books. Good readers read widely. They read lots of different …
Zoroastrianism | World History | Khan Academy
So in any discussion of ancient Persia, we quickly talk about the faith of the Achaemenid Empire, and that’s Zoroastrianism. It’s popularized by Cyrus the Great when he establishes the Achaemenid Empire, takes over the Median Empire, the Babylonian Neo-Ba…
Sun Tzu | How to Fight Smart (The Art of War)
This video doesn’t condone violence or war of any kind, but simply explores the tactics from an ancient text, and how these might work in everyday (non-military) settings in the modern world. Nevertheless, some information and graphics in this video could…
Space Elevator – Science Fiction or the Future of Mankind?
It’s hard to get to space. As much as we all wish there were an easy and affordable way to see our planet floating in the dark, right now, the only way is to become an astronaut or a billionaire. But there is a concept that might make it possible - while …
How Facial Expressions Help Robots Communicate with Us | Nat Geo Explores
[Narrator] There are a lot of us, all with different cultures, languages, beliefs. So, yeah. Communication. It’s not always easy. You’re crazy. You’re crazy. You’re crazy. (slapping) [Narrator] But no matter where we come from or the languages we spea…