Chapter 4

user interface elements

repayments2.fla

the complete repayment calculator, incorporating the code to format a floating point number to 2 decimal places.

 

interface.fla

a checkbox, radio button pair and radio button trio. The arrow button just triggers some trace statements (so it does nothing if you play the SWF file in a browser).

 

fancypopupstar.fla

the unconventional popup menu. The scripts and structure are just the same as you would use for a standard one; only the appearance and placement of the menu items, and the event that opens the menu are unusual.

 

scrolling.fla

scrolling list, with apologies for the unimaginative items

 

drag1.fla

first version (of many) of the drag & drop bookshop. This just lets you drag books into the trolley/basket and leave them there; if you drop them anywhere else they go back home. A slightly less than obvious detail: the trolley has a background layer with a grey rectangle, that matches the overall background. If the gaps had been left transparent, drops would not have registered unless the cursor happened to be over one of the black parts.

 

slider.fla

a slider control. This version has some extra code to highlight the label corresponding to the slider position. This could easily be extended to make other things happen. However, a much better way of linking a slider to other objects is described in Chapter 6. Note that this example uses a font called Sand. You should have this font if you are using Flash under MacOS8.5 or later. On Windows or earlier versions of MacOS you may have to substitute some other font to use this movie. Since Flash embeds fonts in SWF files, the slider should look OK in your browser on any platform.

 

nav-keys.fla

demo showing the use of keys to navigate between text fields