new Object();
We create our first object and look at its syntax. Learning about 'new' and figuring out what it does.
Video Transcript
00:00How do we create objects? Objects in Flash are written in this way, so I'm going to create a new object
00:05and I'm going to call it O and my object in the same way that I've created my is true and my
00:11Boolean and my UNT, I started off with
00:15colon and after I set my colon I'm going to start typing object, but I'm going to start with an uppercase O
00:25and you can see already that it's highlighting because I'm in Flash CS5, but if it doesn't just continue on typing
00:31object
00:33Now if you are using CS5 or you're using flex you could always just hit enter
00:38And it would select your object
00:40Now that I have my object now we have a variable is defined as a type of object does it have any value in it?
00:47No, let's see if that's true
00:49So if I just trace out my object right now that has nothing in it because we never put anything in it
00:54We only defined it as a variable, but we never put anything into it and we run our application
01:00We're going to see that our output is null and if you recall from a past course null means
01:07No value or more accurately a variable was defined, but it has no value. It's an empty. It's a defined emptiness
01:17Versus undefined like we've said before that undefined is just nothing
01:22Here, it's basically we defined, but we defined nothing so far
01:27It's a very very interesting concept of different types of nothingness in programming
01:32Which they're not very critical to understand all the time, but a lot of times you're going to encounter weird bugs and
01:39After drilling deeply into it you'll find out that
01:43It had something to do with something similar to that so let's see how we create actually our object and
01:50The syntax is actually
01:52Very simple. We're saying we want a new
01:55Space a new what we want a new object, so we're going to ask for a new object
02:00Now the next thing that we want to do is we want to open a round bracket and close a round bracket
02:07Now if you're thinking to yourself, this is kind of odd
02:09Why are we opening and closing a bracket and by the way I've made here an error
02:14I forgot to put an equal before because we want to assign this new value into our variables
02:19Let me just put that in there before we forget
02:23So what I'm doing here is I'm creating my new object which is called. Oh, I'm basically going to the blueprint
02:29The blueprint is called object which as we said before blueprints and programming words is a class
02:36We're going to the class of object and asking for it to create a new object
02:42now the part that might be a bit confusing is almost not almost but everything in flash is objects and as you read on an
02:49online forms or you experience on your own and you watch our videos or other videos online you're going to encounter a
02:58Lot of usages for object objects is kind of a generic term for almost everything
03:04When it comes to flash, but the root of it is exactly what we created right now
03:09We created a new object which is really what an object is
03:13But everything in flash is an object which is a part that will could get confusing
03:19But before we get confused let's try to nail down this object and understand
03:24What is its purpose and how we actually use it?
03:27So just to recap we always start with new any
03:30We start with new space the type of thing that we want to create which in our scenario is an object
03:37Which I'm hinting that in the future when we create other types of
03:41objects we would say
03:43New and whatever the other thing is and the same thing if you would notice with this huge list that came out here
03:49are some of the built-in type of classes of
03:53Definitions that you could create with them different types of objects and as you notice right now
03:58I'm kind of using the word object for two different things
04:01Let's nail that down right now to make sure that we don't get confused
04:05One there is an object, which is an object
04:09Which is our object that we created right now and the other object is everything is an object in an object oriented world
04:17So if I create something if I create a movie clip, which is a visual object. I'm actually creating a type of object
04:24even our
04:26Booleans are you and our numbers everything we created so far are types of objects their type of variables
04:34It's kind of synonymous almost
04:37Okay, so we've created our object now that we know how to create our object and we know well
04:42We know what its purpose is we know that it's going to be a bucket for information
04:46Let's see how we could use this bucket
