The Traits Object

New to the ActionScript language, the traits object was added to provide true class inheritance. The inclusion of a traits object greatly reduces the delay caused by property lookup. In previous ActionScript languages, object properties were shared among cloned objects by what was known as the prototype chain. If the property targeted on an instantiated object couldn't be found, the expected property is searched for within the next object up the chain, and the search continued until the top-level object was found.

The traits object vastly enhances property lookup by eliminating the need for the prototype chain. Every class, when compiled, possesses a number of objects, one of which is the new traits object. The traits object ...

Get AdvancED ActionScript 3.0: Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.