The Custom AS3 Classes Involved

The code for both applets on the previous pages resides in the custom AS3 classes in the package bkde.as3.* and on the MainTimeline of gallery.fla for the first applet, and choose.fla for the second applet. The Timeline code in each case is short; most of the work is done by the custom classes. Let us look first at the classes required by gallery.fla which loads examples from the external xml file, paramart.xml. The Timeline code in gallery.fla in thoroughly commented, so it should explain a lot.

  • ParamGallery  class in the package bkde.as3.boards. The class loads an external xml file and creates arrays of strings corresponding to the data for each example. The data for a particular example can be accessed (and is accessed when the user clicks on the next or the previous button in the Gallery applet) via getExample(exampleNumber) method of the ParamGallery class. The class dispatches a custom event when an xml file being loaded finished loading and the examples have been prepared, or a custom error event if the xml file cannot be loaded (for reasons other than Flash Player security).
     
  • ParamArtBoard  class in the package bkde.as3.boards. The class parses the data for each particular example using the MathParser and the RangeParser classes and plots the curves. The class also draws the square graphing board and controls the error display box.
     
  • MathParser  class in the package bkde.as3.parsers. The class parses formulas for the coordinate functions x(t,a,b) and y(t,a,b). It evaluates the formulas for specific values of t, a, and b if parsing was successful. Otherwise, the instance of MathParser displays a specific error message as to where a mistake in syntax has been found. The class uses a helper class CompiledObject.
     
  • RangeParser  class in the package bkde.as3.parsers. The class parses entries for the x, y, t, a, and b ranges. Those entries may contain expressions involving 'pi'. If a mistake in range entries is found, RangeParser displays an error message. The class uses a helper class RangeObject.
     
  • HorizontalSlider and VerticalSlider  classes in the package bkde.as3.utilities. These classes provide a light-weight, easily customizable alternative to Flash CS3 slider component. The HorizontalSlider class is discussed thoroughly in the tutorial: "A Custom HorizontalSlider AS3 Class in Action: Applying Color Tints to a Photo". The functionality of the sliders is quite obvious.
     

The list of public methods and properties for each class can be found in the pdf guide contained in the package parametric_art.zip that you can download below, as well as the source code for each class.

The file choose.fla that corresponds to the applet on the page two of this presentation uses the same classes except for ParamGallery which it does not need.

Download

  • Download all 'fla', 'as', xml, and pdf files corresponding to this experiment: parametric_art.zip

We hope you enjoy playing with our Parametric Art applet and find it useful!

Back to Advanced Tutorials and Experiments              Back to Flash and Math Home

The site www.flashandmath.com is maintained by Doug Ensley (doug@flashandmath.com) and Barbara Kaskosz (barbara@flashandmath.com).
It has been developed with partial funding from the National Science Foundation and the Mathematical Association of America.