Reviewing the more simple and traditional way of developing in flash. In this video we break down the timeline and explain how to utilize it in coding.
If you choose not to work in OOP, the opposing alternative is timeline coding. Learn what this means, how to create new layers, and use our frames effectively.
Now if you choose not to work in this format,
and again we recommend that you do, but if
you choose not to, the way you would
do that is if you click on your main again
and you get back into your main.fla,
and you go into your properties panel, what
you would want to do is you'd want to delete
your main reference
and when you delete your main reference,
now there's no linkage between our main and our class.
So if we'd now click on our edit, it's
not going to go anywhere. It's gonna ask us
to put a name because we don't really have
one.
So I'm going to save my file now. Now because I've
opened this file previously in a earlier
version, it's asking me if I want to save it
up to Flash CS5. So I'm not going to
save it right now because it's not really
important for me to save.
If I run the application now, it's going
to output nothing, because there's no
connection now between our main and our *.as
file.
The way we would program if we choose to work
not in an object oriented mode is to go to
our timeline,
we're gonna create a new layer,
and we're gonna name that layer, so I'm going to
double click on layer two,
I'm going to select everything, and I'm going to type here a s
just to make sure that
everyone knows that our code is
in the *.as layer.
Now that we have our *.as selected, I have to
select the first frame,
which every one of these lines are
possible frames, although they're disabled frames
these don't exist yet, the only active frames
right now are these two,
and I want to select my frame right now in
frame one,
and now that it's selected, I could click on
my window> actions panel.
Now, make sure that you don't have by mistake,
something selected, so if I just go here and
create myself a rectangle,
and it has a really big thick
stroke, but that's fine, and you can see that now that it's selected,
you'll see that in ActionScript 3.0,
code cannot be placed directly on objects. Please
select a frame or use the code snippets
panel yadda yadda yadda.
To our point, what that means is that we want
to make sure that our frame is selected and
not the object.
The way I make sure that that will happen
is, any items that I creative, I don't create
on the same layer as my *.as layer.
So I'd like to just lock my *.as layer making
sure that I won't put anything on it.
So I could select that layer,
and directly go into my actions frame
in my actions panel,
and then I could start coding, so for example
if previously we saw the sample
of hello world,
let's create that sample again.
We could just type trace, open a round bracket,
open a double quote, type Hello, space, world,
close our double quote,
close our round bracket, and then semicolon.
Now if you run our application,
we should be getting
in our output panel, "hello world".
That's all you really need to do to make
that choice between our path of the object oriented path,
and the traditional path of coding directly
on the timeline.