Reflection AddObject Method

Almost all Physlets support one or more add methods designed to create an object and add it to the applet.  These objects usually, but not always, have an on-screen representation.  The addObject method is usually the most general.  It has the following signature

addObject(String name, String attributes)

The first argument is the name of the object to be added, and the second is a comma-delimited list of parameters. 

The reflection applets supports a single type of object, a layer.  Layers are added left to right and represent either a dielectric film in EM mode or a region of potential energy in QM mode.  The two parameters are the width of the layer and the index of refraction (or potential) of the layer.  A layer can be added using any of the following JavaScript statement:

document.physletname.addObject("layer", "w=1,n=2");

document.physletname.addObject("film", "w=1,n=2");.

document.physletname.addObject("medium", "w=1,n=2");.