_level0 as a Class Instance [Archive URL] [Comments: 8]

There is an interesting bit of code for making the root of your movie a class instance. This eliminates an extra nested movieclip and makes things much cleaner. Plus it works with AS2.&

This essentially makes the movie a class instance and all objects/properties/movieclips are within the class instance. Notice the lack of an import statement and that there are zero clips in the library.

Source Example

//modify the inheiritance chain to point to a Class
this.__proto__ = Application['prototype']

//call the Class constuctor targeting the root or this
_global.Application.apply( this , [] )


Anytime you want to call a method you can go any of the following:

this.myMethod()
_level0.myMethod()
_root.myMethod()


Now if we could only find a way to create forms and views at runtime without predefined library movieClips. Looks like a job for FLOW!