One technique I've been trying lately is to assert linkage of class
names. First I create a static function that asserts that a symbol is
linked to a certain class. It returns the symbol ID if so, and throws an
error if not:

class com.exopolis.exosite.errors.SymbolError extends Error {
        //...
        public static function assertRegistered(linkageID:String,
                                                classFunc:Function,
                                              className:String):String {
                if (!Object.registerClass(linkageID, classFunc)) {
                        throw new SymbolError(linkageID, className);
                }
                return linkageID;
        }
}

Then in any MovieClip subclass, I can do something like this:

import com.exopolis.exosite.errors.SymbolError;
class mypackage.MyComponent extends MovieClip {
        //...
        public static var LINKAGE_ID:String
                = SymbolError.assertRegistered("MyComponent",
                                           MyComponent,
                                           "MyComponent");
}

That way, the symbol is automatically registered to the class, and if
there is no such symbol, an error is thrown (which does not disrupt any
other processes).
--
Mike Keesey

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to