Recently a trainee asked me – How do we go about plotting a sine wave? We were doing a basic ActionScript course and I was explaining the Drawing API, and how we could easily draw circles and rectangles etc. We then got into working out distances and I mentioned that it is all down to Pythagoras’ theorem, and from there we talked about cosine and sine and the question was - How do we go about plotting a sine wave?
Well, drawing anything in ActionScript 3 can be accomplished by the lineTo() function, and it would have to run off an ENTER_FRAME event, so that gave us the skeleton functionality of our code…
