Creating Service Modules

The My Page framework does not know or care which modules are being loaded, so you can add any kind of service module you want, using the three sample modules as exemplars. Remember to use relative addresses; avoid absolute references using _root. Because the service module movies are loaded into movie clips, _root refers to the framework’s main timeline and not to the main timeline of the service .swf.

Making Notes

A common feature of My Page applications is the ability to make notes that are stored between sessions. This feature might be used for making daily goals lists, reminders, directions, or phone numbers. The notes module is instructional in that it uses a local shared object to store information—the user’s notes—between sessions.

The notes module uses the ScrollBar component, so add the component symbol to the notes.fla document’s Library by dragging an instance from the Components panel to the Stage (and then deleting the instance from the Stage).

The following example shows the code for notes.fla as it should appear on the first frame of the main timeline:

// Include MovieClip.as from Chapter 7 and TextField.as from Chapter 8. #include "MovieClip.as" #include "TextField.as" // Create the form elements used. function initNotes ( ) { // Create the text field used for accepting user input and displaying notes. this.createInputTextField("notes", this.getNewDepth( ), 0, 0, 100, 200); notes.multiline = true; notes.wordWrap = true; // Create the scrollbar ...

Get Actionscript Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.