02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

Is Alpha 0 and Visible False the Same?

One of the questions we where asked during this live event was %u201Cis alpha 0 and visiblity at false the same?%u201D. There not. In this video we will talk about what that actually means and see how do we sort out the issue of having items on the screen with an alpha of 0.

Video Transcript

00:00Any and then if they're none then we'll move to chapter 2
00:08Yeah, absolutely. We're I hope we're gonna get to let's move that we'll do that in our
00:13Next chapter, but could you you know?
00:16When you're saying in general just what's the difference to invisible true and visible false
00:25By the way, CR 204 you're totally right
00:28The first animation just completely skipped nothing happened to when we did the override all in the I'm not sure and by the way
00:39Probably I don't think there really is
00:42Visible false property in between on oh, I think it only exists from tween light and up
00:48Um, I could give it like a quick kind of answer about that, but it involves plugins
00:53So let's but I promise y'all answer that towards a little bit of the of the
01:00After we do a little bit of tween light and basically I could give you it in just like in general and high high note
01:06You know, we're already 30 minutes in so the time is running. But so let me give you a quick answer and then we'll continue
01:13And tacos asking because you played around with tween light and tween max already before and you noticed that when you set the property to false
01:20And you know, let me let's just do it
01:22You know, I'm gonna change my lecture and just go for your question because it's a really good question. So let me just close this up
01:29I'm gonna move on to chapter 2. We'll do it in chapter 2. So I'm just gonna open up a new class here
01:37All right, let me just open that up
01:43Beautiful, all right
01:44So the chapter 2 is unfortunate we're gonna be probably the last chapter that we're gonna be talking about and and I'm gonna play around with
01:50This chapter a little bit. It's not gonna be that real chapter 2 that I plan for this
01:54Answer to your question is actually inside of my chapter
01:59Let's see. It's in my chapter 4 I believe
02:02Yeah, it's in my chapter 4 which will we weren't planning and getting there, but let's just jump to chapter 4
02:08It's not harder in any way or form. So what we're gonna do right now is
02:13explicitly only
02:15Tween lighter up you can't do it in Anano at all and let's see what it is
02:19So first of all, I'm just gonna create a really quick animation and I'm just gonna even go I'm gonna go to team names
02:24I'm just gonna make it to be visible false for a second
02:27And now we're gonna create a quick animation with the tween light library already pre-loaded it. We're gonna do a to animation
02:36We're gonna take our MC logo. It's gonna take a second and we're gonna alpha it out
02:42to zero
02:44Okay, so in general when I'm doing this animation I faded out my object
02:49Beautiful. Now. I have a question to all of you and probably in particular
02:55The object has been faded out
02:57Does that mean it's not being rendered?
03:01It's kind of a it's a trick question, um, if it's faded out already, we don't see it at all
03:06Does that mean flash is not rendering that object anymore?
03:12bingo
03:14Bingo, exactly. And is that a bet you know, like and in general whenever something is being rendered and it's not being visible
03:21it's even
03:23In general anything with an alpha even if you just put an alpha of like zero that 99
03:29You're automatically adding processing power because creating alpha forces flash to use four channels instead of three channels
03:36But in general, it means that your objects automatically is going to take more RAM from your memory
03:42now, it doesn't really matter if it's just one object, but imagine that you have
03:46500 objects that are just invisible on your stage it will not really invisible with alpha zero on your stage
03:53Well, your biggest problem right now is that you're overloading your system
03:57Even though you don't really need those resources and you really want to have a simple way of telling flash. Hey
04:02Don't render this anymore
04:05Contrary to that and I'm saying contrary to that, but here's another question, right? We set our
04:10text field visible value to false
04:13Does that mean it's not being rendered anymore or will it be rendered? Okay. I'm gonna give you a second to answer
04:29Exactly. You know, you're you're you're absolutely right. That's exactly my point
04:32So while if I set something to be alpha zero, I'm literally
04:37Forcing flash to work really really hard even though I don't really need it to work hard
04:42But when I set the value to visible false, I'm basically telling flash don't render this at all. Ignore it
04:47Don't don't even ignore the fact that it's on the stage. Just skip it. Don't render it
04:52so that lowers the the the the the pain from flash to be from flash to deal with it now
04:59Now when we go back into our animation here for a second
05:02I'll go back for questions in a second and I'm fading my alpha to zero
05:06I have a lot of ways to dealing with that. So one is like if I wanted to
05:10Basically, I wanted to make it go away, right? And that's really what I want to do
05:14So to make it go away what I would do is I'm going to add here some sort of an on complete function, right?
05:19Oncomplete and I would send the variable and I'm good. And by the way, I'm just showing you now how you do this
05:24So I want to be called whenever the animation is complete
05:26So I'm going to call the on complete and I'll just call your on animation complete a function
05:33I'll just go down here right underneath and create a new function and I always have typos
05:45But even if I have a typo, it will be the same typo and then it's not that bad
05:51Okay, so we just have your little trace I am
05:56Done
05:58We're gonna run this
05:59So what's gonna happen is as our animation finishes and it's gonna trace out I am done beautiful
06:03So what I want to do next is instead of saying I am done
06:06I'm gonna go to my object. I'm gonna say MC logo dot visible equals
06:13Equals folks and by doing that I'm basically getting my animation off with a reloading scene
06:20If there's other thing other things going on at the same time
06:23Well, it doesn't really matter because slash is not gonna render that MC logo anymore
06:27And by the way doing if you're doing something or you're not doing something by default based on your on your frame rate in my case
06:34It's 24 frames a second
06:35Even though we're not animating flashes going 24 times a second to check to see if anything updated and if so to re-render it
06:43So by setting it to false, it's just not going to that property to ask for its update
06:47So it doesn't it reduces not only visually it reduces the load from flash in general because it doesn't have to refresh it anymore
06:55Okay, so does that answer the question about what is the difference between alpha and false?
06:59I know that you had a further question there and I am going to answer it in a second
07:14Okay, did that
07:15Bobble did that answer the question so far and I know there's a second parts of that question in which I'm gonna go for it
07:21You know being dynamic is what it's all about. Oh, it definitely isn't I'm gonna show you
07:36I'm gonna show you how to add that plugin now now that now that you're saying that but now you know the difference between visible false and
07:42Alpha zero and why it's important. Why would you want to worry about it?

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!