flash document_class_value

The value of the document class

Since the introduction of ActionScript 2, developers were used to creating a class which served as a point of entry to their application. This instantiated other objects which needed to access the main timeline. They therefore had to give a reference to the main timeline.

It was therefore quite common to find the following code on an image in the timeline:

var myApplication:Application = new Application ( this );

The application could also be initialised using a simple static method:

Application.initialise ( this );

Other developers used another technique consisting of changing the execution context from the main class with the following code:

this.__proto__= Application.prototype;
Application['apply']( this , null );

By using the keyword this in the class instance Application we reference the main timeline. ActionScript 3 integrates a new functionality called Document Class allowing us to avoid having to resort to these old practices.








Adobe Training center


Mediabox Training Centre © 2000 - 2008 All rights reserved.
Adobe Authorized Training Centre. State convention under number 25 14 02167 14.
Mediabox : SARL au capital de 62.000€ - Activity number: 25 14 02167 14 - SIRET : 493 716 468 00027
MEDIABOX, 102 Avenue des Champs Elysées, 75008 PARIS - Tel. +33(0)2.31.91.96.89 - Fax. +33(0)2.72.68.56.42