Bezier Curves (and other code)
I have a confession to make. In all the years that I’ve been learning from other people on the internet, I don’t think I’ve once given anything back. Ok, I do answer a lot of programming questions from strangers over email, but as far as contributing code to the online community, I’ve been pretty silent.
I think maybe it’s because I’ve never wanted to publicly admit that I’m a nerd. Or maybe it’s that I’ve never felt like I had time to talk about programming when I had so much of it to do.
Either way, it’s about to change. Nerd glory, here I come.
(Disclaimer: If you’re not an ActionScript3 programmer, you probably won’t care to read past this sentence).
Last night at about 11pm I decided to tackle a problem that had been bugging me for years: How did the amazing programmer Robert Hodgin create the beautiful glowing curves on version 7 of flight404.com? (Yeah, I know it’s been keeping you up at night, too).
I started working on it and then got a little side-tracked… but I did manage to create some nice code that I couldn’t find anywhere else on the internet. So in rare form, I decided to share it.
It’s a class for AS3 that draws bezier curves. Or more precisely, curves with any number of control points. It’s based on the simplified curved lines from Grant Skinner, but I changed it so it doesn’t start and end with a straight line segment, and more importantly, I made it a really simple class for anyone to use.
The example code does a lot of stuff… and hopefully it’s valuable for any budding coders who are starting to ask the complicated questions that come up after that first Hello World plateau.
Here are some things you might get from it:
- Bezier Curves
- How to structure classes and objects
- A bit of TweenLite animation
- Full-browser flash (with minimum height and width)
- Drawing a background gradient that fills the screen
- Handling browser resizes
- Creating and using a custom event class
- Keyboard events
- Simple physics with gravity/magnetism/friction
View the example
Download the full example source code (AS3)
Download just the Curves Class

