Previous Bezier Spline examples have illustrated how to draw a spline directly with pre-generated data in MXML. In some applications, it is desirable to define the Bezier Spline in MXML, but generate knots (control points) dynamically.
The following diagram shows our infamous arrow generated one segment at a time.
The demo allows one knot to be added or deleted (starting with the minimum of three) until the full set is defined. You may optionally close the spline to complete the drawing. Once the spline is closed, however, it is not recommended to remove and add knots because of the internal bookkeeping inside the Bezier Spline.
The control points are dynamically redrawn based on the internally generated propertyChange event, which also controls the spline redraw. This should illustrate the basics of defining a spline in MXML and dynamically generating knots via script. Download the MXML file here.