Skip to Content »

FlashApe » archive for October, 2007

 Limit the use of ‘private’ in your AS 3 classes

  • October 19th, 2007
  • 1:42 pm

In AS2, we really only had two access control modifiers for an object’s properties and methods…public or private (and you can through in static as well, but even static properties could be public or private). In AS 3, we have more options, and ‘private’ works in a different way than in AS 2.

Lately I’ve been digging through a bunch of different AS3 packages that I’ve downloaded, and I’ve run into a ton of situations where properties that should be marked ‘protected’ were marked as ‘private’. Now, the reason this is a problem is that ‘private’ properties cannot be accessed by subclasses. Using ‘protected’ allows subclasses to access the properties of the parent class, without making them public.

I’m not saying never to use ‘private’, but I feel in most situations, ‘protected’ (or even ‘internal’) is what you really want, especially in cases such as component development, or any case where you can almost count on your classes being subclassed.

More info here

 Adios, Dreamhost…hello mt

  • October 12th, 2007
  • 10:57 am

Got tired of dreamhost’s never-ending technical/hardware/email issues and made the jump to a mediatemple dv server. Took me a couple of days to get everything up and running and the dns switched over but I think I’m all good now. If I have time I’ll post some notes on he switch, there were a few sticky points that were a little hard to figure out and find info on.