Click-and-Drag Actions


We've mentioned that there are a lot of methods and properties in the ElectroServerAS object, and many of them are going to be really useful for your game development. But don't think you have to remember the syntax for even the ones you use all the time. You can install these actions directly into the Actions toolbox in the Actions panel in Flash (that's a lot of Action!), and drag and drop them into the script pane whenever you want to use them. This installation will also enable color-coding for all ElectroServerAS actions.

  1. Open Flash.

  2. graphics/cd_icon.gif

    Locate the install.swf file in the AppendixC directory, and open it inside the Flash environment (as a SWF don't import it!).

  3. Click the Install ElectroServerAS Object Actions button.

    The actions are now installed. Close the SWF and look in the Actions panel. You'll see that the ElectroServerAS object is now an option in the Actions panel. Currently there is no documentation (reference help) installed with these actions; this appendix will serve as the documentation. However, by the time this book is published, there will probably be an updated installer for these actions (see www.electrotank.com/ElectroServer) that should contain the reference help.

  4. For the color-coded version, close Flash and then reopen it.

In order for all of these actions to work, you must include the file ElectroServerAS.as within the Flash file that is to make use of the ElectroServerAS object. ElectroServerAS.as is a text file that contains all of the ActionScript used to define the methods and properties of the ElectroServerAS object. You don't ever need to open or edit this file (unless you want to extend the object's capabilities).

To include ElectroServerAS.as with your movie (which you must do to make use of its actions) follow this simple procedure:

  1. Copy the ElectroServerAS.as file into the directory where your Flash movie is saved.

  2. Copy WDDX_mx.as into that same directory.

    This file enables the ElectroServerAS object to send ActionScript objects.

  3. Add this line of ActionScript to the main timeline anywhere before you need to start using the ElectroServerAS object:

     #include "ElectroServerAS.as"  

That's it. Now when you create a SWF movie, all of the information in the ElectroServerAS.as file will be pulled into it. You do not need to insert an include action for WDDX_mx.as, because ElectroServerAS.as does that for you automatically.



Macromedia Flash MX Game Design Demystified(c) The Official Guide to Creating Games with Flash
Macromedia Flash MX Game Design Demystified: The Official Guide to Creating Games with Flash -- First 1st Printing -- CD Included
ISBN: B003HP4RW2
EAN: N/A
Year: 2005
Pages: 163
Authors: Jobe Makar

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