socketserver AS3 clientDownload the socketserver AS3 sample client here (I'm assuming that you have already downloaded and successfully run socketserver before you try to set up a flash client.) So once you have your server running, possibly even talking to something on a serial port, how about getting out of the text-based world of Terminal and into something a little prettier? Let's go with Flash; it's a pretty well established development environment, and nowadays with actionscript 3 you can extend it to do just about anything you want. All we're going to do is run the server, start this client, and send some messages over the server to flash. When flash gets the messages, it will print the message on the screen. Pretty simple, huh? If you decompress and open the downloaded directory (SocketServerAS3Client) you will see 3 things: an .fla file (that you can mess around with), a published .swf file (it should be noted that this swf was created with network-without-filesystem privileges... maybe some day I'll write up a simple description of what flash will and won't let you do when messing with servers), and a folder named 'com'. When you mess around with the .fla, it's important that you have the 'com' folder (and all of its contents) in the same directory as the .fla; 'com' has the definition of a CustomSocket class in it, and that's what we're using to talk to the server. So let's get this running! I'm providing instructions for OS X and will add instructions for Windows to this page when I get around to writing the Windows version of socketserver, but the actual instructions will be about the same:
There are a lot of places for the above instructions to go bad. Let's start with the most obvious one: you don't have the standalone flash player. That's easy if you have the flash plugin for your web browser... just drag the swf into an opened browser window and the browser's flash plugin will play it fine. There are also a lot of ways to mess up the server setup, but I've covered that setup on another page. If it actually worked for you and you have Flash CS3, you should open the fla and play with it. Here are some things to try:
Here's the download link to the sample files again... |