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
how to find out what you want to do in life - watch this if you feel lost
If you’re spending your day scrolling on social media, watching TikToks, Instagram reels, shorts, whatever, if you hate your current job and think, “I wish I had a dream job that I’m passionate about that I can spend hours without even realizing it,” and …
Safari Live - Day 69 | Nat Geo WILD
Well hidden at the moment, tucked away in the long grass, and you can see that one of the little cubs is suckling away. So, these are the four cubs that we saw playing with the game drive blanket not all that long ago, tugging it backwards and forwards an…
Interest Rate Cuts Have Begun.
The time has come for policy to adjust. The direction of travel is clear, and the timing and pace of rate cuts will depend on incoming data, the evolving outlook, and the balance of risks. Well, you heard it folks, that is Jerome Powell, the Chair of the …
How To Become A MILLIONAIRE - The Truth No One TELLS YOU! | Kevin O'Leary & Barbara Corcoran
Oh, you can’t believe where we are tonight. We’re in Barbara’s home. This place is a very secret penthouse. I’m trying to make it exciting, Barbara, but we have a beautiful view of the park. We’re in the kitchen because Barbara is making me dinner tonight…
What is NOT Random?
What will happen tomorrow is not random. In other words, it’s at least somewhat predictable. I mean, not entirely to be sure, but some things will happen for certain, and other things definitely won’t. For example, the sun will rise, water will still free…
Princess Diana's Funeral | Being The Queen
[music playing] On the eve of Princess Diana’s funeral, the royal family is returning to London, hoping perhaps to quell some of the criticism of their actions since Diana’s death. REPORTER: The queen’s convoy arrived in London. As it swept up to Bucking…