Chapter 5
abstraction
recursion.fla
the put_commas example function, with some tests.
map.fla
a simple higher-order function).
format_floats2.fla
the format_fp function to format a floating point number to 2 decimal places. The last test reveals the answer to Exercise 3(b).
jukebox-adt.fla
the Flash movie jukebox using a queue abstract data type. This version fixes a subtle bug in the published script (see the list of errors). If you wish to experiment with it, you will have to prepare some movies for it to play and edit the URLs appropriately. Movies at the default Flash size of 550 by 400 will look reasonably OK. You may like to change the movie so that instead of loading into level 1 it loads into a dummy movie clip. That way, you will find it easier to position the loaded movies in a pleasing fashion.
format_floats.fla
generalization of the preceding function, to format a floating point number to n places.
records.fla
an example of inheritance, with some very simple tests.
HTMLSelection2.fla
the HTMLSelection object. This is the version that overrides the methods of Selection. The behaviour of the button is not intuitive: if you click on it, nothing happens, but if you press the . key (full stop/period), a trace of the state of the selection will be displayed in the output window.
In each of the movies above, except the jukebox, the script is attached to the first frame and uses trace to produce its output. The movies have no graphic content and won't appear to do anything in a browser. Open the FLA in Flash and use the Control>Test Movie command.