Go to Page... |
Thread Tools | Display Modes |
08-03-2012, 11:44 AM | #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:
Code:
import com.sammichofdoom.lib.RootClass.RootClass; import com.sammichofdoom.ExampleWindow.ExampleWindow; RootClass.Register(this, ExampleWindow); Code:
/** * 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); } } |
|
SecretUI » Developer Discussions » Tutorials & Other Helpful Info » [CODE] Registering a Class to Document Root. |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|