problem with accessing functions

Giganews Newsgroups
Subject: problem with accessing functions
Posted by:  [RaZoR] (nonexistent@antispam.address)
Date: Thu, 04 Sep 2003


main script creates IE window, put an array there and then calls a child
script. chils script makes an array element equal to some object and
returns control to main script. then main script doesn't see that object
and its functions. why?

here is the code I implemented:

//in main script
oWSH = new ActiveXObject(WScript.Shell);
oIEWindow.document.Script.MyArray = new Array()
oWSH.Run("child.js", 2, true);

//in child.js script
var MyObj = function() {
  var Value = 3.14159;
  var getValue = function()    { return Value; }
  var setValue = function(arg) { Value = arg; }
  this.gV = getValue;
  this.sV = setValue;
oIEWindow.document.Script.MyArray[0] = new MyObj();
oIEWindow.document.Script.MyArray[0].sV(2.71); // <-- this works
oIEWindow.document.Script.MyArray[0].gV();    // <-- this works

//returning back to main
oIEWindow.document.Script.MyArray[0].gV()      // <-- this doesn't work

is it possible to set an object in array and call its functions from a
child script and then call'em again from main script?

what did I assume wrong in this code?

please help,

ps. I also tried the following definition of MyObj with no success:

var MyObj = function() {
  mo = new Object();
  mo.Value = 3.14159;
  mo.gV = function()    { return mo.Value; }
  mo.sV = function(arg) { mo.Value = arg; }
  return mo;