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

Split Paths : OOP

In this video, we take a step further into our OOP programming, object orientated programming. Seeing where we will code along with a very high level overview of the different elements we're working with. We will learn two ways to run an application. We actually get a look at certain things in detail, such as the contents of a basic AS file, a 'package.' Hint: a package tells Flash what directory the OOP class "Main" is in. This video explains what a 'movie clip' is: it is contained in the package. Learn to define a new object that is created dynamically as we're running the application: the object is actually the application!


NOTE: Everything in Flash is case-sensitive: if you name a class "Bouncing_Ball" and later call it "bouncing_ball," you'll get an error.


I'm sure we will find things in our output and compiler errors if we make a mistake anywhere in the coding. Not to worry, this is a natural process and you can expect some mistakes and errors to be made. It's learning from those mistakes and actually bookmarking future solutions that help you become a great developer.

Still working in Split Paths: More OOP

We continue our steps along the path of OOP programming by learning how to send a value to the output panel. (Does "Hello World" sound familiar? ;) We show you examples and give you the exact run-down of how to run our applications. Also, in the most likely case that you become stuck or receive an error or caution warning, examples and solutions to your problems are provided.

Split Paths cont. OOP Video Transcript

Video Transcript

00:00So how do we actually get all these stuff set up so if we go back into our project files?
00:05I'm just going to double-click into it
00:06And I'm going to go directly to my source and into our main if I click on our main
00:12It's going to open up, and I'm going to toggle back into our finder
00:16And I'm going to double-click on our main data. Yes as well
00:21If I click into our main data, yes
00:22We're going to see this is a file structure here that has some code in it
00:26And we're kind of like pre-written amount of code that we're just going to have there always
00:30Until we learn a little bit more about object-oriented programming. We're just going to assume that that just has to be there always
00:37If I now to make a linkage between where we're going to code and our
00:43FLA we have to actually tell our FLA that our stage from now on our root our application
00:50Hub are where our source code begins is
00:54Our main data. Yes, and the way we do that and the way we've done it in our
00:59Pre-downloaded files is we typed the name of our class directly into our class property. We got rid of the data. Yes
01:07Because that we don't need that so we and it wouldn't work if we would and we just typed and it's really important to
01:12Note it's really important uppercase M uppercase M all the rest lowercase everything in flash
01:18It's very very important to make sure that you type it exactly the same way or things won't work
01:23The way that you expect them to work
01:26So we have our linkage between our class and our main
01:30So let's see how we could run our applications
01:34obviously if we run our application right now because we said we haven't done anything yet, and we just run it and
01:40That's another point that we have to make sure how do we run our application so far?
01:44It was a magic that I was working on
01:46The way we run our application is going through our control and then clicking on test movie
01:57And enter so command enter would then run my application
02:05So command enter is really how we want to run our application most of the time as we're testing our
02:10Application and as we run things we're gonna see things in our command compiler error and our output if we have any mistakes
02:17So let's link back that we store the compiler error
02:20But if we go now into our mainas and we know that it's linked together and the way we know is we have our class
02:25That is main and if we click on this edit class definition this pencil tool thingy
02:30And we click on it. It will take us into our mainas
02:34In our mainas if we had any errors, let's say we by mistake didn't add a bracket
02:38Let's just delete this bracket and don't worry about what it is and why it's there
02:42But it just has to be there and if we try to run our application again by clicking on our command enter
02:48We're gonna see that we're gonna automatically get a compiling error
02:51Which is gonna tell us that there's something that it's missing and we're not gonna dig into it right now
02:55But basically it means that we're missing what we had to have there. Well if we run it with it with it, then everything is fine
03:02Okay, so that was our compiling errors. Let's see how we could trigger things into our output now with that said it brings us to
03:09Where is the area that we could type in?
03:12and I'm just gonna run through what we have here just really quickly and
03:17We're not really gonna dig too deep into it right now because it's really early on
03:22We're just gonna what my really request right now is just assume that this always has to be here
03:26But let's just see this our package is
03:29basically
03:31Basically saying like in one
03:33Telling flash and what directory are applicable our main is sitting and right now our main is sitting in the exact same directory
03:39We're gonna see how we could work with setting it in different packages in future videos
03:44But for our sake and purpose we always open a curly bracket to kind of contain something
03:50So everything inside of this curly bracket area, and I'm just gonna highlight it
03:54Everything inside of here is part of this package. Don't worry about what is a package now inside of this package
03:59We're importing a movie clip, which is basically our base foundation block, which is our
04:06Our route our application where we're actually switching our route to be our movie clip
04:12And a movie clip is it has all the functionalities and all the code kind of built into it
04:17That flash needs to know how to run our application and for now
04:21That's all we really need to know about it right now and here. We're defining a new class. Which is our new object and
04:28I know these these are you know like I'm really running through it very very vaguely and the reason is because it's there's a lot
04:34Of details we would have to get into to be able to really understand these things and in this intro videos
04:39We're really not going to really touch object oriented programming, but we're going to work inside of the environment of an object oriented program
04:48In other words all of this is defining what we're doing is we're defining a new object that is then created
04:55Dynamically as we're running the application we're creating a new object and this object is actually our application
05:02now
05:04Inside between as you can see our public function main open round bracket closed round bracket open curly bracket closed curly bracket
05:13between our open curly bracket and closed curly bracket of our main function is where we will put all of our code from now on until we
05:22Now what I want to do is now that we know that and don't worry about really don't worry about why just assume that you
05:31Just have to have all this and all your code has to come right here
05:34So all your code has to come in where I'm just typing right now
05:38now I'm going to teach you a really quick kind of
05:41command
05:43which in flash is called a function and
05:46We're going to run our function this quick function
05:48We're not going to go into the diesels of what functions are going to look at that in the future video in this release
05:53We're just going to see how could we trigger things to output into the output panel and the way we do that
05:59We're just going to type trace. We're going to open a round bracket
06:02We're going to click on shift
06:06Comma just to create a double quote and we're going to click. We're going to type
06:12very very cheesy hello world
06:17Close our quote same type double quote close our round bracket and then put here in
06:25semicolon
06:26And that's all we really need to be able to run our first application
06:30And what this will do is it's going to send this string that's going to send this value to our output panel
06:36And if I run my application again again using my command enter
06:41I'm going to see in my output panel hello world and it's not part of our application users can't see it
06:46But our us as we're testing our application. We could see our hello world
06:52Now this is we were working in our object oriented world now
06:56Obviously we haven't really dug much into this world and what everything here actually means what is the class? What is an object?
07:02What is a movie clip?
07:04What are functions? Why are we inside of a function when we're making these calls?
07:09What are packages and so on and we're not really going to answer to those questions in these initial?
07:16Videos, we're just deliberately sitting inside of the object oriented kind of
07:21Area to make it easier and kind of getting used to being in there as we decrypt and slowly slowly understand
07:28What are the different pieces that are here?

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!