Following on from part one and two, we now deal with sending messages to specific peers in a large group (where large means 15+ members).
Continue reading
Category Archives: Tutorials
P2P Flash On A Local Network Part 2
Following on from part 1, i have adapted the code to to enable message sending to specific peers (or in p2p jargon, direct routing). I have added a label to display the instances’ (truncated) ID and a dropdown list to select the recipient of the message:
Continue reading
P2P Flash On A Local Network Part 1
Flash Player has provided an API for peer-to-peer communication since 10.1 (and in AIR since 2.0). P2P over the Internet requires some server-side technology (such as Flash Media Server) but on a local network it’s really easy; no server stuff and it can be set up in a few lines of code.
Continue reading
JavaScript for Flashers Part 3: ExternalInterface
In parts one and two, i dealt with specific JavaScript libraries but this time i will cover general communication between Flash and JavaScript. Namely, calling Flash methods from JavaScript and JavaScript methods from Flash.
Continue reading
JavaScript for Flashers Part 2: SWFAddress
SWFAddress is a JavaScript and ActionScript library for adding deep-linking functionality to Flash websites; allowing users to navigate using the browser back and next buttons in the same way as an HTML website. It’s dead easy to use so let’s dive in…
Continue reading
JavaScript for Flashers Part 1: SWFObject
As fantastic as Flash is, it can’t do everything; sometimes we need to use other technologies to get results. For Flash running in a browser, JavaScript is a useful (and sometimes essential) tool.
I categorise my use of JavaScript into three areas: 1. Essential: embedding Flash in HTML (and providing alternative content), 2. Semi-essential: deep-linking (using browser back/next buttons for Flash navigation) and 3. Optional: everything else. I will cover 2 & 3 in later posts, but first…
Continue reading
Get Pixel Colour Below Mouse Pointer
I’ve noticed that this question pops up from time to time on forums, and it’s very straight-forward to do; we can use the draw() method of BitmapData to copy any visual element (in this case, the stage itself) into a BitmapData object. Then we can use the getPixel() method to extract the colour.
Continue reading
Drawing Bezier Curves
For the un-initiated, Bezier Curves are curves defined by a set of (at least 2) points in space (usually defined by x and y coordinates). By setting appropriate sets of points, complex curving paths can easily be defined. These could be simply drawn to the screen or used as paths for visual objects (eg a game character) to follow.
The simplest case is a curve defined by 2 points – which is just a straight line. As more points are added the curvature can become more complex. The curveTo method of the Graphics class uses a Bezier Curve of 3 points (1 point defined by the current drawing position and 2 points passed into the method).
So, if we want to draw a 2 or 3 point Bezier Curve, Flash can do the work for us, but for 4 points or more we need to handle it ourselves. Also, if we are using a Bezier Curve as a path for an object to follow, we need to know the coordinates at all positions along the path and the drawing methods of Flash wont help us with that.
Continue reading
Beep And Other Sounds Part 2
If you’ve read part 1, you already know how to generate sound – just pass some values into a ByteArray when a SampleDataEvent event fires – so now let’s see what kind of noises we can make.
Continue reading
Beep And Other Sounds Part 1
If you are an old codger like me, you will (fondly?) remember the sounds of early computer games. They were mostly monotone beeps and bips, but there were some real gems that took the audio experience seriously (think Defender) and used the simple audio abilities in more interesting ways.
Now, just 30 years later, Flash can also generate it’s own sound…
Continue reading
