In one of the LFC files I declare a global
var ConstructorMap = {};
which gets turned into it's own declaration file by the script compiler
ConstructorMap.as:
package {
public var ConstructorMap = {};
}
In each LFC file I have a statement to add a tag to this global
dynamic class LzView extends LzNode {
static var tagname = 'view';
ConstructorMap[tagname] = LzView;
dynamic class LzAnimator extends LzAnimatorGroup {
static var tagname = 'animator';
ConstructorMap[tagname] = LzAnimator;
dynamic class LzText extends LzView {
static var tagname = 'text';
ConstructorMap[tagname] = LzText;
But when the system is running, there is no entry in ConstructorMap['text'],
in fact
the only entries in the ConstructorMap are
view: [class LzView], node: [class LzNode], canvas: [class LzCanvas],
missing are animator, layout, animatorgroup, text
So I'm wondering is there some arbitrary ordering issue where some of the
classes are executing the "ConstructorMap[foo] = bar" before ConstructorMap
actually gets initialized, and silently failing, or what? I can't figure
out if this is a compiler bug in Flex or if I'm doing something wrong.
According to
the AS3 docs, statements at the top level of a class declaration get
executed once
when the class is defined. But I am wondering how that interacts with global
var initializations,
maybe the order is arbitrary?
--
Henry Minsky
Software Architect
[EMAIL PROTECTED]