Subj : RE: named scope To : netscape.public.mozilla.jseng From : Stuart Date : Mon Aug 23 2004 01:12 pm Igor, Thanks, your reply was very helpfull. To clarify my first question what I am trying to do is support something like: I have various variable scopes, namely: session, document and anonymous. If there was a variable declared with session scope (e.g var x = 2) there could be some script at an anonymous scope which could use this variable in one of two ways e.g. var y = x + 5 -or- var y = session.x + 5 I am not sure how to support this. I addition to figuring out how to do the above I'd like to ask a follow up question regarding your reply. The link you gave me had some code snippets e.g.: Context cx = Context.enter(); try { Scriptable windowJS = Context.toObject(window, libraryScope); windowJS.setParent(null); windowJS.setPrototype(libraryScope); documentScope = cx.newObject(windowJS); documentScope.setParent(null); documentScope.setPrototype(windowJS); ScriptableObject.putProperty(documentScope, "window", documentScope); ScriptableObject.putProperty(documentScope, "self", documentScope); } finally { Context.exit(); } All of these code snippets used the setPrototype() rather than setParent(). Perhaps my confusion is caused by my first question (session.x) but when would you use setParent() rather then setPrototype()? Is the only difference the scope in which the new variable would get created (if you did not use the var)? Thanks in advance. I think I'm almost ready to dive into my coding!!! Regards, Stuart Broad .