[CODE] Registering a Class to Document Root. - SecretUI
Thread Tools Display Modes
Unread 08-03-2012, 11:44 AM   #1
sammichofdoom's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2012
Posts: 1
[CODE] Registering a Class to Document Root.

In order to register a class with the root of a flash document. On frame one of your fla add some actionscript. Typically game files have a #include here. Instead do something like this:

import com.sammichofdoom.lib.RootClass.RootClass;
import com.sammichofdoom.ExampleWindow.ExampleWindow;

RootClass.Register(this, ExampleWindow);
 * RootClass is a simple helper class to register a class to the root of a movieclip.
 * @author Sammiches
 * Example:
 * import lib.RootClass.RootClass;
 * import src.ExampleWindow.ExampleWindowBase;
 * RootClass.Register(this, ExampleWindowBase);
class com.sammichofdoom.lib.RootClass.RootClass
	 * Register
	 * Register applies the ctor of the supplied class to the root of the supplied movie clip.
	 * @param pMovieClip:MovieClip - root of the movieclip, typically "this".
	 * @param pObjClass:Object -  class you wish to register to supplied movieclip.
	public static function Register(pMovieClip:MovieClip, pObjClass):Void
		pMovieClip.__proto__ = Function(pObjClass).prototype;
		Function(pObjClass).apply(pMovieClip, null);
sammichofdoom is offline   Reply With Quote

Go BackSecretUI » Developer Discussions » Tutorials & Other Helpful Info » [CODE] Registering a Class to Document Root.

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off