List Info

Thread: RE: Class vrs Object




RE: Class vrs Object
country flaguser name
United States
2007-08-22 14:26:56
George Langley  wrote:

> Are there other ways to make an object? Again, thinking
Director,
> you can make a behaviour to drag on a sprite, and treat
that as an
> object, accessing "property" variables that
are retained as long as
> the sprite is present. You can put an AS script on an
instance in the
> Flash timeline, but do they have a
"properties" equivalent, or do we
> need to use global variables?

ActionsScript 2 is pretty much a full implementation of OOP,
with a few
oddities and exceptions (private vars, but no protected
vars--you get that
in AS3).

The standard way of making an object in Flash is something
like this:

var myBall:Ball = new Ball (args);

The only other way I can think of is the rather odd way of
subclassing
MovieClip. That's covered in the help file nicely, so I
won't go into the
mechanics of creating an instance.

I would highly recommend two books, both by Colin Moock:
"ActionScript for
Flash MX: The Definitive Guide" and "Essential
ActionScript 2.0" (or 3.0, if
you're in a position where you can write AS3). The technical
editor for both
is none other than our own Bruce Epstein, the guy who wrote
the "In a
Nutshell" books about Director. He's now not only a
premier Director guru,
but also a premier Flash guru.

Anyway, the second book, Essential ActionScript, contains
pretty much all
you'll need to get going on Flash's version of OOP. The
first is an
invaluable reference, and delves into some of the mechanics
of Flash like
levels (believe me, you need to know levels). The
ActionScript examples are
a bit dated, as they are mostly AS1, but don't skim over
them too quickly.
There are bananas of pure gold, even in the AS1 examples.

Cordially,

Kerry Thompson


_______________________________________________
Flashnewbiechattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashnewb
ie

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.c
om

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )