I may be able to give guidance. Understand that XML is read from source depth-first and quite naturally (after consideration of the system) instantiation happens depth-first reverse. In other words the compiler translates OL programs into the runtime (javascript) in the the same order as an XML document is parsed, (depth-first, top to bottom). The innermost classes are instantiated before their parents are (depth-first reverse). Putting a class at the 'top' of the canvas means that it gets interpreted by the runtime before class definitions it needs are interpreted and included to use.

Another part of the initialization solution is:

<handler name="oninit" reference="canvas">
        .....
</handler>

So that although your code that depends will run at initialization time, all other objects will be instantiated (since they are children of the canvas and children are initialized first). (note, the reference tag is handy and available in the documentation for handler.)

Although i'm not answering your question specifically, HTH.

.j.

On Jul 15, 2007, at 11:56 PM, Robin Sheat wrote:

I have a class (extends node) that contains a few other things that manage other parts of the program. I'd like this to be instantiated as soon as possible, and I'm declaring it near the top of the canvas. In particular, it's used in constraints on things further down in the canvas, however I
often get exceptions that classes I try to access in it are undefined.

I have put initstage="immediate" in the containing class, but it doesn't seem
to help.

--
Robin <[EMAIL PROTECTED]> JabberID: <[EMAIL PROTECTED]>

Hostes alienigeni me abduxerunt. Qui annus est?

PGP Key 0xA99CEB6D = 5957 6D23 8B16 EFAB FEF8 7175 14D3 6485 A99C EB6D

Reply via email to