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

This,That And The Other Thing

Talking about the relationship between our Main class and the root/time-line of our FLA. Ok then so what Is 'this', 'root', 'stage' and 'parent'?

Video Transcript

00:00All right, so I have opened up my main FLA and my main FLA is connected
00:05It has a linkage as a document class that it's set up to this main .as so far
00:11we said that we have our FLA and we have our main class and
00:16We really didn't explain too much what actually that meant and I wanted to just break it down just a bit
00:22And I know that we're gonna get it a little bit more into details with this as we go on
00:27But the main point here right now that we want to make a connection between us saying
00:31Actually what bit when we link between our main and our our main FLA and our main as we're actually saying that our main
00:39as is
00:40actually
00:42Going to create our movie. What does that mean?
00:46So basically whatever we have inside of here will actually get
00:50Created into our FLA and because this is the document class and we're gonna see exactly in a second how that actually works
00:56Now we're gonna look into
00:58Classes and how we define them and this is a perfect example of a definition of a class
01:02But we're gonna look into what classes mean later on as we build our own independent classes
01:07But right now we're assuming that we have only one class, which is our main class
01:11And that main class encapsulates everything
01:14So for example, if I just go back into our main and if I just even throw inside of here a trace
01:21Alright, and if I put inside of your trace and I say this and what does this mean this as the name probably implies is
01:28Itself we're just asking to trace whatever we are or wherever we are more accurately
01:34So if I save that file and I just run it we're gonna see that our trace command is going to output something interesting
01:41So it's telling us that our where our output is our main which kind of makes sense, right?
01:47Because we have our object and it's our main
01:50Now to make things a little bit more interesting. There's another property in flash
01:54That's available only to the visual display objects that are actually on the stage and our main is on the stage
02:00It's automatically put onto the stage
02:04If we trace out to see what it is our root
02:07And we're gonna just take trace out the word root and the root basically says bring us them
02:12You know the root the beginning the definition or in other words
02:15Maybe the document class give us the base structure of the visual elements
02:20and we're gonna see later on how we add more elements and we're gonna see something interesting our
02:24Root is actually are this inside of the main. What does that tell us? It tells us that basically our
02:30basic movie clip our first our first visual element on the stage is our root
02:37Or are this or our main in this scenario?
02:40Well, this is a dynamic word right because if we would be in a different place, which we don't know how to create yet
02:45This would be something else
02:48So we see that there's this interesting relationship
02:51And I just wanted to add a third item and we're gonna get back to these elements a little bit later in the course
02:56And I just want to trace out the stage
02:59And what is the stage the stage is actually the parent of the root which is a little bit confusing and a little bit
03:06Different than earlier versions of flash, but basically the stage is the definition before our definition even it's the mother of all mothers
03:15Well, our main is our
03:17Root it's the beginning but above the root. There is a stage and how do I know above the root? There is a stage
03:24I'm gonna introduce to you another property
03:26so first we see that our stage is we have access to the stage and
03:30Now one more trace and don't worry if this is not a hundred percent sinking in because we're gonna revisit all of these
03:36concepts of this root stage and one last item throughout this course as we learn how to build objects, which is
03:44Really close right now how do we create our visual objects on the stage?
03:49so if I just trace out parent
03:52Which is our fourth parameter that we wanted to learn about and parent is a property of a movie clip every movie clip
03:58Every display object has a parent
04:01Or not in our scenario
04:04Well, everyone has a property of parent, but that doesn't mean they have a parent to have a parent and actually
04:09Really have a parent you have to have a parent means you have to be on the stage if you are on the stage
04:14You have a parent only exception to that rule is the stage right the stage doesn't have a parent the stage is
04:22the
04:23Father or mother of all ancestors while the root is the first child of the stage
04:29Okay, so if I trace that parent, what do you think will come out because our what is where are we right now?
04:35when I'm in when I'm asking for parent
04:37We're inside of this even if I don't say the explicit word this because the parent property belongs to the main
04:44Which is our root?
04:47So I'm basically asking what is the parent of the root and just from the talk that we just had right now
04:52I hope you could get to that assumption that our parent would be the
04:57I
04:57Hope I that was right, but the answer is the state
05:00Alright, so if I asked for the oh, I need to save it as always
05:04I always don't say and if I save it and I print it out bam
05:08We're getting our stage now
05:11Obviously, this is a hard-coded value root and the stage is a hard-coded value
05:16while this and
05:18Parent change depending on where we are
05:20All right, and and don't worry if this is a little bit vague as long as you get the idea that there's a relationship
05:27There's a hierarchy where visual elements have parents and they might have children and the next step
05:33We're actually going to do right now. We're going to create a few new children to our root in our scenario our main
05:39Okay, so in the next few videos, we're going to start practicing that practicing adding children
05:44But we're going to get back to the idea of everything and that's a display object
05:48Could have a parent unless it's a stage which the stage can't have a parent because it's that's it. It's a stage

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!