Henry,
At the time you have looked at ConstructorMap, have you
already created a LzText object? If not, maybe it's doing
lazy creation of the classes - I know that Java does this -
static initializers and blocks don't occur until the class is
loaded, and a class may not be loaded until some code executes
that either creates an object of that type or references a static
method/var.
On Jan 9, 2008, at 9:59 AM, Henry Minsky wrote:
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]
--
Don Anderson
Java/C/C++, Berkeley DB, systems consultant
voice: 617-547-7881
email: [EMAIL PROTECTED]
www: http://www.ddanderson.com