Richard,
> I ran in to the "1037: Package Cannot Be Nested" error
when
> using the sample code in Flash help
Ah, good one! Yes, thanks for bringing this up. A number of
the
current 3rd party ActionScript books -- and, as you pointed
out, most of the
sample code in the docs -- is written in the form of class
files. I've
heard from a number of people who have tried to copy/paste
such code into
keyframes, then see the 1037 compiler error.
In ActionScript 3.0, all SWFs have a Document class one way
or the
other. If you don't assign one yourself, such as the
MyClass.as you
mentioned, the SWF will receive a default Document class by
the name of
MainTimeline. Which means the SWF's code is already declared
inside a
package (automatically). The introduction of a second
(seemingly original)
package declaration in timeline code cause those two packages
to be nested,
which is not allowed.
David Stiller
Co-author, Foundation Flash CS3 for Designers
http://tinyurl.com/2k29mj
"Luck is the residue of good design."