Using Code Examples
Keep in mind that there is a difference between the teaching examples
shown in the book and robust, deployment-ready code. Always consult
the web site for the latest and greatest version of a given example.
 |
Source files (including many that don't appear in
the book) can be downloaded from the book's web site
at http://www.flash-communications.net.
Package names begin with the path
com.oreilly.pfcs.
|
|
This book is here to help you get your job done. In general, you may
use the code in this book in your programs and documentation. You do
not need to contact O'Reilly for permission unless
you're reproducing a significant portion of the
code. For example, writing a program that uses several chunks of code
from this book does not require permission. Selling or distributing a
CD-ROM of examples from O'Reilly books
does require permission. Answering a question by
citing this book and quoting example code does not require
permission. Incorporating a significant amount of example code from
this book into your product's documentation
does require permission.
We appreciate, but do not require, attribution. An attribution
usually includes the title, author, publisher, and ISBN. For example:
"Programming Flash Communication
Server, by Brian Lesser et al.
Copyright 2005 O'Reilly Media, Inc.,
0-596-00504-0."
If you feel your use of code examples falls outside fair use or the
preceding permission, feel free to contact us at
permissions@oreilly.com.
Getting the Code Examples Working
The most common reason for being unable to get a code example to work
(assuming you haven't made any typos) is a failure
to set up the Flash file according to the instructions. Reread the
surrounding text and follow the steps carefully. Be sure to place the
code where it belongs (usually in the first frame of a layer named
Scripts or Actions or in an
external .as or .asc file).
When compiling AS 2.0 code, be sure you've set the
compiler version to ActionScript 2.0 under
File Publish
Settings
Flash ActionScript
Version.
Any code example that accesses movie clips, buttons, or text fields
via ActionScript won't work unless you set the
item's instance name properly. To set the instance
name for a movie clip, button, or text field, select it on stage and
enter the instance name on the left side of the Properties panel
(Window Properties) where
you see the placeholder "<Instance
Name>".
Another common source of problems is failure to set a
symbol's linkage identifier properly, as is
necessary when accessing Library symbols from ActionScript. To set
the linkage identifier for a symbol, check the Export for
ActionScript and Export in First Frame checkboxes in the Symbol
Properties or Linkage Properties dialog box. (These are accessible by
selecting a symbol in the Library
(Window Library) and
choosing either Properties or Linkage from the Library
panel's pop-up Options menu.) Then enter the
identifier in the field labeled Identifier (which
isn't active until Export for ActionScript is
checked).
Read the instructions carefully to make sure you
haven't confused a movie clip instance name with a
symbol linkage identifier.
If you still can't get it working, download the
examples from the book's web site, contact
O'Reilly book support, or check the
book's errata page. If all else fails, get a
tutorial book on Flash or ask an experienced Flasher for help.
 |