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

Visual Inheritance

A small talk about the connection between all visual objects, (hinting to the world of object oriented programing), and understanding how all visual elements are connected to each other.

We will look at the differences between things that are clickable or not, that can have children or not, that have a timeline or not...and so on.

We finish this video by looking at how we read the AS3 help files related to this new topic.

Video Transcript

00:00We created our first display object and actually a display object type was a text field and
00:05We've met also the movie clip even though we didn't access it directly yet
00:09We actually did we created our actually our main and our main throughout all of our different videos throughout our application
00:15We're a type of a movie clip. Okay. Now, there's some similarities between a movie clip and the text field and if you notice
00:23And we're gonna get into object oriented programming very shortly and this is really connected to that
00:28So it's kind of like a little bit of another intro to that
00:32In object oriented programming
00:34Assume that there are some characteristics that pass throughout the different instances of different objects
00:40So for example, if you take in the real world, I have cats which are mammals and I am a mammal as well
00:47So we share some similarities although they're not really my parents and in code
00:52They are kind of but not really right because they're also there's two different of relationships
00:58There are the visual relationships which we've seen it earlier
01:02What is my actual real parent and then when we're talking about the object oriented programming approach, which is another step
01:10Which is more philosophical of who are who do I get my attributes from which is not exactly my parent
01:17Okay, but it's my ancestors
01:19So those terminologies and a lot of people get the whole thing mixed up together because it's very very similar the terminology
01:25And it's really hard to separate between the two
01:28Let's talk about it separately
01:29This is a little bit easier than the the topic we talked about earlier and we're gonna get to the other topic much more in depth
01:35But basically, let's say everything that's a displayable object in flash everything that could be displayed
01:41Inherits some properties from the display object
01:43Some of them could be such as what is their x and y coordinates could they scale could they all these generic?
01:51Properties all these stuff that every single thing needs to have that property everything needs to know
01:54What is it is x what it says y so they all share common app commonalities, right?
02:00Now interactive objects, which is the objects that we're starting to kind of interact with
02:05Pun no one that none intended
02:08So interactive objects would have a few more features which enables us to add interactivity such as clicking and events
02:15Which we're going to look into such as well clicking and rolling over and maybe keyboard events and just things that are related to
02:22Interactions. All right
02:24Now there's a lot of different types and we're going to look into those different types in the following few videos
02:29But right now we're focused on our text field which our text field as far as we know right now be just because of looking
02:35At this list. We know that our text field is an interactive object and it's also a display object in
02:41Its ancestry lists right, but we couldn't say the other way around we can't say the display object is a text field
02:46Right, that's not true
02:47But we could always say that a movie clip is a type of a sprite and we could say a movie clip is a type
02:53Of a display object container and a movie clip is a type of interactive object, right?
02:58We can't say a movie clip is a type of text field. That's not no doesn't make any sense, right?
03:04Very good. So basically with the whole point of this, this is a great great list and it's it's on the adobe
03:10Dot-com site and I'm gonna upload the link onto our website as well
03:13So you could find it in our course page and and this is a fantastic chart
03:18When you get a little bit confused as you're starting things up
03:20It's a very simple chart and it basically just shows you that relationship in details
03:25And why is that important now?
03:27We're gonna start working with a few properties and some of these properties will belong to every single display object
03:33So instead of me teaching right now that you could take a text field and move its X and Y coordinates
03:38When I teach you about those X and Y coordinates
03:40I could say any display object has X and Y coordinates
03:44and what would that mean as you learn about videos and shapes and
03:49Bitmaps and interactive objects and so on and so on you'll know that all of them have those properties
03:54Now we're not assuming that you're gonna remember all those properties
03:57But it's really important to notice those stuff because it's gonna obviously you learned something about one object
04:03You're learning actually stuff about a lot of other objects
04:05Then we're gonna look into the how and why later on but that is kind of a rational relationship saying that there's a lot of
04:12features and behaviors that are already pre-existing
04:16That automatically are inherited to whatever we're working with and that's actually a good keyword, which is inheritance
04:21Basically our text field inherits properties from the interactive object which inherits properties from the display object
04:29Okay
04:29now I have opened up the text field and I want to go there for a second just to show you as you go into
04:35Into looking into the documentation was the crit which is a critical area
04:38That you're gonna visit quite often as you're programming because you're not gonna remember every single
04:43Every single event or property. I don't know one really does, but you need to familiarize yourself with it, of course
04:50And as you go if you go into the help and we're just gonna jump in there right now
04:54And we look into our text field we're gonna see automatically in the top of our list
04:58It's actually telling us that a whole chain now if we jump back for a second into our display object
05:03We're seeing that display object was our last thing in the chain
05:07But it's not really the last thing. Okay, it's not the really the last thing because it has other
05:14Ancestors which we said in flash everything starts from an object and we can see that it really does
05:19So we see that it's an object that dispatches events. It's a display object. It's an interactive object and it's a text field after that
05:27Okay, so actually we learned right now that there's properties that belong to the object that event dispatcher to display object
05:33So as we learn about these properties and the ways to interact with them
05:37We're actually going to learn them for every single thing in flash that inherits its properties from that and the easiest way to find that
05:43Out is just visiting the help for that specific element. So for example in our text field, we could see that inheritance chain
05:49Okay. Now obviously if we're already in our help
05:53You want to make sure that you know what version of flash the documentation is for
05:57okay, so this class is related to flash 9 action script 3 and
06:02If we scroll down a bit and I'm gonna skip a little bit
06:05We're gonna see public properties and we see in our public properties
06:08Do we want to see the inherited public properties or not right now?
06:12We don't so we see are all the different properties that belong exclusively to the text field
06:18And you can see that as well as in the defined by text field
06:21now if we wanted to see the more properties we could have seen all properties all the inherited properties and that
06:27Leads us back back up here if we wanted to see all the properties
06:31They got all the way through from the object all the way to the interactive object then we could open up that list
06:37By clicking on show inherited properties, which would then extend our properties and show us definitions
06:43That came from different places that belong to our text field as well
06:45But they were defined earlier on in the chain, for example a constructor, which was created by the object itself, which
06:53Or interactive object we have double-click enabled and so on and so on there's quite a lot of properties
06:59Which I really encourage you play around with them and notice what actually belongs
07:04Exclusively to text field and what belongs to display object or something earlier than that because as you notice those
07:11Differentiations you are going to actually expand your horizon way beyond what we actually could do in any amount of videos
07:18Because as you make those connections your act you're you know, you're solid you're you're building up that core foundation that you need for really
07:26Mastering any language especially object-oriented languages which are leaning on features
07:31So as you learn different functionalities those functionalities repeat over and over

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!