Before we can start programing or thinking as a Flasher we need to understand what the basic file types are that Flash uses. There are two distinct file types in Flash: the source files and the deployment files. Source files we want to keep away from the users' reach while the deployment files should be deployed to their destination, such as the web. The most common source files are *.fla files and *.as source file types whlie the most common deployment files are *.swf and *.html. Here is a more detailed breakdown:
*.fla files and *.as files are your source files. . Your *.as files are your ActionScript files which are external files that contain your code. Your code will be categorized into classes, which we will explain later. .as files are only text, and can be opened in a text editor. Your *.fla file is your hub. Everything that you need to set up your application is inside the .fla file, including your assets, images, configurations, etc.
The source files are compiled into different formats depending on the platforms they will be used on On the other hand, your deployment files are intermediary files. In your deploy, you will have your *.swf (the compiled application) and the *.html file which serves as the wrapper to run your application in a browser. Your Flash player will take your deployment files, decrypt them, and tell the computer how to run your exciting new animated application!
So you downloaded the source files and it really
doesn't matter from which of the coding basics courses you chose.
In any of them you'll find the project folder. Unzip it and open it (now let me just drag this
into our view).
You'll see that there are 2 folders. There's
your source folder and your deploy folder.
Flash is like all programming languages that compile. There are languages that don't compile, likeJavascript.
What that means is, there are languages
that, on the user system,
the computer has to read your code,
figure out what's going on, translate that
into a language that your computer can actually understand,
and then run those applications.
Flash is not one of those types of applications, it actually compiles.
Compiling basically means that it translates
code into some sort of machine language
that is much easier, and
less work for your computer to then decrypt and
understand. Thus, you have your source files, which are
humanly readable
files and configurations. The source and
all things that you're going to work with like editors,
if it's your Flash CS3 CS4 CS5
maybe even CS6 when it comes out.
As3.0 are source files, but because
we want to compress the files, we want to make
sure that
it's as close to machine language
as we can, so it's easier on the processor
that the files are smaller.
We compile them into different formats
depending on the platform that it's supposed
to go to. If it's a desktop application,
we're going to compile it differently.
If we're going to run it on the web, we're going to compile
it differently and so on.
Different operating
systems, different platforms
demand different low-level interactions
with the machine.
In a way it's like
a translator, speaking in the most simplistic way.
Your source files are then translated
into a mediator language,
that the end user or your computer then
is capable of understanding.
I'm saying it's a mediator language because
we're not compiling it down into machine code.
We're compiling it into
an intermediary language just as java is
if you're familiar with java.
It's basically like a mini language,
and if you have
a Flash plugin running on your browser,
then that Flash plugin is the translator
that translates all what it needs to translate
into your applications. So in a way, there's three steps.
There's the source. You deploy your intermediary files,
and then there's your Flash player which actually
takes those files and decrypts them and breaks
them down even more and gives information to your computer
how to run it.
We care that we have our source
and our deploy. Our source will never be
uploaded and sent to anyone if we don't want people
to access our work that we've worked on.
If you only want them to view it,
then we'll only show them our deployment files. We'll post to the web only
those deployment files, and only e-mail those and so on.
so what file formats are involved with Flash?
Well, obviously we're not going to talk about all the
different file formats that
Flash supports because that's not our main focus,
however let's go over the file formats that we're
going to be working with.
There are two different file types in our source files,
.FLA file type and.AS file type.
Our FLA file type is still
one of the most popular ways of working with Flash,
although there are ways to work without it today.
It's still here and it's very important.
What are the FLA files?
FLA file is basically our heart. It's
where we start everything up.
On the other hand, I'm going to first explain what the
.AS file is because it's going to make it a little bit easier.
Our .AS file is our script where we're going to put all our code.
It's only text,
while our FLA file is kind of like
our hub, our library where we can put assets in it and images,
even code as well if we wanted but we prefer not to.
We're going to put all our
configurations and all the things we want
to set up for our file.
Then, we could choose to use external files
if we want or we could opt out, but we always
need to start from our root. Now,
while we're working on CS3, CS4, or CS5
in our scenario we're going to always be working on FLA file
formats. Now there's obviously differences and different
between file types.
In AS 3.0, the preferred way of working
is putting classes into your AS files.
The way that we set up our file structures
is that
we have our main, and most of our videos are
going to be main.as,
and all our code is going to be sitting in
main.as, until we dig deeper into understanding
what classes are. Now,
what are all the rest of the files from zero all the way to eleven?
These are associated with the video number
that you're watching, although in this tutorial
it's not, in every other
course, when you download the courses and you see
the different
numbers, these numbers correlate to the video
that you're watching. So if you want to
grab the code instead of typing it on your own,
or you want to revisit the code later on,
you could always
open up the AS file and grab it.
Ok-so that's really it about our source. We said
that our FLA is our
hub where all our assets are sitting and everything
that's related to our project is sitting for now.
The .AS files are always going
to be a class (we don't really know
what that is yet,) but basically from our perspective
right now
all of our code is going to sit inside of
our AS file type.
Now what's inside of our deploy? Let's look
into our deploy.
There's a lot of different deployments, it
really depends where are we going to publish.
But for our sake of
coding basics, we're always just going to do
the basics -- the SWF -- which is
basically our compiled application.
As we said, our compiled application is basically
compressed and minimized and
translated into a closer level to machine
level programming language,
where it's easier to understand for the processor and
the Flash player, throughout the different
operating systems and platforms that
Flash player runs on these days,
making it easier for it to actually understand it
the same way
throughout, without the overhead of actually
compiling on run time.
Or, in other words, actually translating
our human readable code
into machine readable language.
Now, as we said, Javascript is a language
which doesn't compile (or compiles
on the fly,( so when you go into a browser and
it's javascript heavy,
a lot of times you're going to see that it's slower
than the Flash application.
The reason why it's slower than a Flash
application is because your browser actually
has to first
understand what that copy is
before you could actually start interacting
with it.
Now, modern browsers have a lot of different
interesting ways of dealing with that such as
compiling it on the fly, and so on,
but
the end point is,
because our applications are pre-compiled,
we have a little bit more control over
our content, because people can't
just see our code directly as easily.
Also, it cuts down the amount of time that it takes
the browser and the users' computer to understand
what's going on.
As long as they have their Flash player, they're
more or less ready to go!
Alright, so that was our SWF which is
a really critical file. Now we wouldn't want
to by mistake, because I've seen that
so many times,
you don't want to upload your FLA's or
AS files by mistake on to a web site,
especially if you're building it for a client.
It's very important to differentiate between
those two files types, and that's why I'm
deliberately, throughout all the projects, I'm
setting the source in one folder and the deploy
in another one.
It's a very good practice to always separate them.
Now, you have HTML file, we're not going to dig
too deep into what HTML is, but HTML is
our wrapper for Flash which is going to be
enable us to run our application in a browser.
Although in our coding basics
we're really not going to run it on a
browser, so we're not too concerned about the
HTML file: it's just the default file type
that's added into our project when we compile
it through Flash CS3 and up.
Well, previous versions as well but now
that we're talking about AS 3.0.
So, that's all I really have to say about our
file types for now.
All we have to know
is it's our main library where all of our
assets are sitting, where
everything starts from, all the
commands, all the initiation process
starts from here.
This is the heart of our source file, this
is what actually compiles.
Then we have our .AS files which are
external files that depend on our FLA.
so in our FLA we're actually going to link
our external class, our external file to our
FLA.
Without it, it wouldn't know that
it's connected to our FLA.
Now in our deploy file we said...
Just to repeat it, we said our FLA
is our
main source file. It's where we have our
assets. It's not text.
It's usually bigger files.
It could have text in it but you can't open it
in a text editor,
Your code in
external files ia basically text. You could
open it up in text editors; they're small files,
and then we're talking about our deploy which we said
our deploy is basically our SWF
what is our SWF?
our SWF is basically, if I go back to
our FLA, it's our FLA plus any other
external assets that our FLA
requested for in compiling time and we're going to
see what that means.
In compiling time,
it then compiles it and compresses it and puts
it all into one bundle into on file.
Our HTML file is just our wrapper file that we can use
to run our application in an HTML page.
Ok-so those were our 4 file formats that we really
need to make sure that
we're comfortable with.