18.4 Further Exploration

 <  Day Day Up  >  

Because our clock is an MVC application, it is incredibly flexible. New interfaces, input responses, and functionality can easily be added to the clock. If you're keen to experiment with MVC in ActionScript, try the following exercises:

  • Create a view that can display a different time zone.

  • Create a new view that displays a creative representation of the hours, minutes, and seconds of the clock ”perhaps use shapes on screen to represent the time: circles for the hours, triangles for the minutes, and squares for the seconds.

  • Create a new view that makes a ticking sound every second and, at the top of every hour , gongs to indicate the current time.

  • Add components to the ClockTools view that let the user set the current time.

  • Change the ClockModel so that it updates by polling the computer's system time instead of by counting milliseconds with setInterval( ) . Hint: you'll need the Date( ) class.

  • Change the clock so it can display hundredths of a second, like a stopwatch.

  • Let the user set the time by dragging the analog hands or editing the digital display.

If you'd like to continue reading about the MVC design pattern, see the following online articles:


Steve Burbeck's canonical Applications Programming in Smalltalk-80(TM): How to use Model-View-Controller (MVC)

http://st-www.cs.uiuc.edu/users/smarch/st-docs/mvc.html


John Hunt's You've got the model-view-controller ( excellent article with complete example source in Java)

http://www.jaydeetechnology.co.uk/planetjava/tutorials/swing/Model-View-Controller.PDF


Richard Baldwin 's Implementing The Model-View-Controller Paradigm using Observer and Observable

http://www.dickbaldwin.com/java/Java200.htm


Sun's Java BluePrints: Model-View-Controller

http://java.sun.com/blueprints/patterns/MVC-detailed.html

In the next (and final) chapter, we'll continue our coverage of interclass update mechanisms by studying the delegation event model.

 <  Day Day Up  >  


Essential ActionScript 2.0
Essential ActionScript 2.0
ISBN: 0596006527
EAN: 2147483647
Year: 2004
Pages: 177
Authors: Colin Moock

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net