Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form name in a function 3

Status
Not open for further replies.

A1Pat

IS-IT--Management
Jun 7, 2004
454
0
0
US
Hi all,
I'm trying to modify this original function that is used to open a form when called:
Code:
function Do_Connect()
{	
	mySDK.WESPSDKMonitor.ClientPullingMode = 0;
	mySDK.WESPSDKMonitor.Connect();
}
and as you can see, the form name "mySDK" is located right in the beginning of the 2 lines.

What I want to do is to open more than one form instead by doing this:
Code:
function Do_Connect()
{	
	var arrCams = Channel.value.split(",");
	var x;
	for (x=0;x<arrCams.length;x++) {
          mySDK[arrCams[x]].WESPSDKMonitor.ClientPullingMode = 0;
		mySDK[arrCams[x]].WESPSDKMonitor.Connect();
	}
}
however, an error is given "mySDK is undefined" as the function goes.

I tried to hard-code by replacing the For loop with this given form name as mySDK1, mySDK2:
Code:
function Do_Connect()
{	
	var arrCams = Channel.value.split(",");
	var x;
	for (x=0;x<arrCams.length;x++) {
		mySDK1.WESPSDKMonitor.ClientPullingMode = 0;
		mySDK1.WESPSDKMonitor.Connect();
		mySDK2.WESPSDKMonitor.ClientPullingMode = 0;
		mySDK2.WESPSDKMonitor.Connect();
	}
}
and it works!

So, my question is... what's wrong here? why mySDK(x) doesn't work while mySDK1 is ok?

Please help!
 
It works now, Dan.
You forgot to tell me to replace the whole frm.WESPSDKMonitor with the cam. Thanks! Still, if you please explain the pros and cons of the eval() function.
 
eval() is essentially a "cheat", it's what you do when you don't know what to do, not considered good practice to default to it.

eval() is also a very slow statement to run compared to other statements.

The only thing eval() is good for is JSON.

[monkey][snake] <.
 
Thank you monksnake for the explaination.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top