The ActionScript Editor in Flash MX has come a long way since it was first introduced. Access it by pressing F9 or selecting Window, Actions. There are two modes to the editor: Normal mode and Expert mode. Normal mode uses a wizard-type approach for writing ActionScript and does not allow you to directly edit the ActionScript by hand, whereas Expert mode does. Coding will be the focus in these chapters, so you should be in Expert mode to follow along (see Figure 6.1).
Enter Expert mode by clicking the Actions panel to bring it to focus and pressing Ctrl+Shift+E. Alternatively, you can use the Properties menu, located on the upper-right corner of the panel.
Turning on View Line Numbers will help you when debugging your code. Flash MX notifies you of scripting errors by referencing the Frame, Layer, and Line Number. Line numbering can be enabled by pressing Ctrl+Shift+L or selecting View Line Numbers from the panel Properties menu.
Programmers learning Flash for the first time are often confused by the Timeline. These next five chapters will work exclusively on Layer 1 in Frame 1. You will know ActionScript is contained within this frame when the letter "a" appears in the frame, as seen in Figure 6.2.
Code hints like those found in Homesite, Macromedia Dreamweaver, or DMX are a great new part of the ActionScript Editor (see Figure 6.3). They are displayed as you type code into the editor. To get the most out of the code hints, use special suffixes on your object names. For example, if a MovieClip instance is on the stage, naming it myClip_mc enables the code hints for the MovieClip object to appear. The _mc is what the editor senses. Reference to these code hint suffixes will be mentioned through this book. When using object methods, code hints display the required and optional parameters. A full list of code hints is presented in Chapter 12, "Client-Side (Flash) ActionScript," in the "Code Hints" section.
The Actions panel is a handy guide to access and reference the properties, methods, and events of every Flash MX object. When you install the Communication Server authoring components, a new book called "communications" appears. Take a few moments to look through the new objects you now have control over. There is also full documentation on each object installed in the Reference Panel (Shift+F1). Appendix B,"Flash ActionScript Objects Quick Reference," contains a full list of each object.
SharedObject and LocalConnection are also included in the communications book. These two objects are native objects in Flash MX but their Actions panel entry was excluded in the original release. The Communication Server does not use LocalConnection; however, it has extended the native function of the SharedObject. SharedObjects will be discussed in Chapter 8, "STEP 8: Collaboration with SharedObject()." All communication objects excluding NetConnection and NetStream can be used without the Flash Communication Server. However, it wouldn't be too much fun watching yourself or talking with yourself, now would it?
Located on the left side of the editor, the ActionScript panel can be closed and opened quickly to give you more editor space (see Figure 6.4). Just click the arrow in the separator bar, and the panel closes. If you are new to ActionScript, you can drag any function or property from the list inside the panel to the editor.
Code hints for server-side ActionScript are included within Dreamweaver MX. Server configuration XML files also have code hints available when you edit them in Dreamweaver. Try it out by opening Server.xml inside Dreamweaver MX and entering an XML tag used in the Server.xml file.
Now that you have been introduced to the ActionScript Editor and have reviewed some of the new objects available, let's jump into the code with both feet. Establishing a connection to the Communication Server using the NetConnection() object will be your first task.