This
tutorial has many parts to it, to help you navigate and
understand what it is I am trying to explain it has been
expanded to many pages. This tutorial does have a lot of
information to cover even for a simple application like what you will create. Here are some
things I will be covering in my tutorial:
-
Building
the Flash client to connect to the PHP5 socket.
-
Script
the PHP5 socket.
-
Write a Batch file to run the PHP5
socket through command prompt.
-
Other steps to making this chat more
advanced.
Before we begin, I am assuming you have
Apache2.x installed along with PHP5 and Flash 8. To
install Apache2.x and PHP5,
go
here.
Let us begin with the client side. Go ahead and
create a new html file called flash.html.
We will place the flash chat room in there. With that
done, let's get into creating the Flash document.
Start a new Flash document and make the
width '550 px' and height '400 px'. Create a new layer
and name it actions. Lock your newly
created actions layer, for it
will serve for just coding only.
Place a Dynamic Text
box onto the stage of your other layer and give it an
instance name of "msgArea". Also check to make
sure your dynamic text box has the HTML box selected:
[ make sure
your properties looks like mine]
Now place an Input Text box right
below your msgArea box and give it an Instance name of "inputMsg":
[ notice the multi-line text in
case people want to type a lot! ]
So right now,
we are still missing some things, go ahead and drop a UI
scrollbar on to your msgArea so the content inside may
be scrolled. You can find these by going to Window tab,
and clicking on Components. The UI Scrollbar will
automatically resize to the height of your msgArea. Also,
drag and drop a Button component into the stage. Your
Flash stage should look something like this right now: