Description

In this four-step tutorial, we show how to create a simple function grapher in ActionScript 3.

Download

Download all source files corresponding to this tutorial in the following compressed folder.

The zip package contains all well-commented source files and a detailed pdf guide.

Step 1. In Step 1, we graph a predefined function in a predefined range.

Click on the screen shot below to open the final version of Step 1 of this tutorial in the new window:

Step 2. In Step 2, we graph two predefined functions in a predefined range. We discuss the need for masking and the "wrapping at infinity" effect.

Click on the screen shot below to open the final version of Step 2 of this tutorial in the new window:

Step 3. In Step 3, we graph two predefined functions in but we allow the user to input the x and y ranges. We dicuss processing input and error display.

Click on the screen shot below to open the final version of Step 3 of this tutorial in the new window:

Step 4. In Step 4, we allow the user to choose the x and y ranges as well as the function f(x) to be graphed. To make this step possible, we use a custom mathematical formulas parser provided by the class MathParser in the package of classes bkde.as3.*. In this tutorial we use and dicuss MathParser only. For discussion of all classes in the package, full documentation, and templates for graphing functions and parametric curves, see our article Flash Tools for Developers (AS3): Graphing Curves on the Plane  at the MathDL Flash Forum.

Click on the screen shot below to open the final version of Step 4 of this tutorial in the new window:

The pdf guide and the source code that you will find in the zip package at the top of this page will walk you through all the four steps of this tutorial.

Back to Intermediate Tutorials              Back to Flash and Math Home

We welcome your comments, suggestions, and contributions. Click the Contact Us link below and email one of us.

Adobe®, Flash®, ActionScript®, Flex® are registered trademarks of Adobe Systems Incorporated.