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
Michael Burry Just Sold His ENTIRE Stock Portfolio...
Over the past few months, Michael Burry has been one of the most talked about investors, and it’s fair enough too. The guy is certainly not afraid to share his thoughts and opinions on the state of the economy on his Twitter page, interestingly titled “Ca…
The Power Of Pessimism | Stoic Exercises For Inner Peace
Because my video with 7 stoic exercises for inner peace was so successful, I’ve decided to go a bit deeper into each exercise, giving you a little bit more intellectual baggage to ponder over. I’ll start with explaining the praemeditatio malorum by Marcus…
What If You Were 620 Miles Long?
Let’s talk about double pain. If your body was 620 mil long, pain could be your alarm clock. You could bite your toe at bedtime and then go to sleep; you wouldn’t feel any pain until the signal from your toe reached your brain and woke you up 8 hours late…
World's Heaviest Weight
An apple weighs about 1 newton; the world record for jet engine thrust is 570,000 newtons. And the Saturn V rocket that launched people to the moon had a thrust of 33,360,000 newtons. But how can we measure forces this big accurately? Well, we need to ask…
TIL: We Have Lost 50% of Wildlife Since 1970 | Today I Learned
So one thing that really surprised me was from 1970 to 2010. You know, in 40 years, we’ve lost over half our wildlife population. In 2014, there was this study that was done, and basically what they do is look at elephants and tigers and fish and all the…
2d curl nuance
In the last couple of videos, I’ve been talking about curl, where if we have a two-dimensional vector field v defined with component functions p and q. I’ve said that the 2D curl of that function v gives you a new function that also takes in x and y as in…