You are here

Flash Tools for Developers: 3D Graphers in ActionScript 3 - Using the Templates

Author(s): 
Barbara Kaskosz, Doug Ensley

The compressed file param_surf_as3.zip contains all templates and code referenced within the article, and the thirty-nine page Developer's Guide (param_surf_as3.pdf ) gives complete documentation of our parsing and graphing classes as well as examples of how they are used.  The templates below are used as examples in the documentation and can be opened in Flash CS3 to provide a starting point for using these custom classes. Click on any screen shot to go to an active implementation of the template.


Template 1. Parametric Surfaces in ActionScript 3 – Rectangular Coordinates

In this applet, surf_graph_rectan.swf, the user enters parametric formulas for the rectangular coordinates x(t,s), y(t,s), and z(t,s) and for the ranges for t and s. The applet draws the corresponding surface which then can be rotated dynamically. The user can choose the opacity of the surface and scaling constrained option. A gallery of ten pre-programmed examples is provided. In this template, the examples are defined in the fla file. The code in the corresponding fla file contains detailed comments.

Parametric Surface Grapher -- Rectangular Coordinates


Template 2. Parametric Surfaces in ActionScript 3 – Cylindrical Coordinates

In the template surf_graph_cylin.swf, the user enters parametric formulas for the cylindrical coordinates r(t,s), θ(t,s), and z(t,s) and for the ranges for t and s. Other options are the same as in the previous template. A gallery of ten pre-programmed examples is provided. In this template, the examples are defined in an external XML file and loaded at runtime. This makes refreshing the gallery of examples easy without recompiling the fla file. For the runtime loading to work, the XML file, cylindrical.xml, must reside in the same directory as param_surf_cylin_as3.swf. In the fla file, we comment only the parts that are different from the first template.

Parametric Surface Grapher -- Cylindrical Coordinates


Template 3. Parametric Surfaces in ActionScript 3 – Spherical Coordinates

In this applet, surf_graph_sphere.swf, the user enters parametric formulas for the spherical coordinates ρ(t,s), θ(t,s), and φ(t,s) and for the ranges for t and s. Other options are the same as in the previous templates. Again, we provide a gallery of ten pre-programmed examples contained in an external XML file, spherical.xml. In the fla file, we comment only the parts that are specific to this template.

Parametric Surface Grapher -- Spherical Coordinates


Template 4. Graphing Functions of Two Variables in ActionScript 3

In this template, fun_graph3d_white.swf, we present a grapher for functions of two variables. In many ways, it is a special case of a parametric grapher although we use a different coloring method and simplify some parts of the code for that case.

Graphing Functions in Two Variables


Template 5. Graphing Functions of Two Variables in ActionScript 3

The purpose of this template, fun_graph3d_black.swf, is to illustrate the methods for customizing appearance of the grapher using the methods of GraphingBoard3D class.

Graphing Functions in Two Variables

Barbara Kaskosz, Doug Ensley, "Flash Tools for Developers: 3D Graphers in ActionScript 3 - Using the Templates," Convergence (August 2007)