FAQ
Products Showcase Download Extras Support
 
Home :: Support :: Community :: CourseLab Issues

how to call object methods from javascript?

how to call object methods from javascript? 
Author:  Angelo    
Date: 26.05.2008 23:07:32
Hi all,
thanks for your very nice elearning IDE!
I have the following question:
how to call object methods in JAVASCRIPT action?
for instance I would call Show() and Hide() methods of the Agent object.

Thank you
Angelo  
...
Re: (1) how to call object methods from javascript? 
Author:  Angelo    
Date: 29.05.2008 22:57:23
Hi,
Can someone help me please?

Thanks
 
...
Re: (2) (1) how to call object methods from javascript? 
Author:  Slav Shchinov   [Courselab Team]
Date: 09.06.2008 02:22:27
Hi, Angelo,

It is not an easy way.

You can try:

CallMethod(sType, sMethod, oArg)

sType - string, that corresponds object type (usually object's file/folder name, for example "nav_001_selector")

sMethod - string, method name (not pretty name used in dialog! real name)

oArg - object, contains at least one parameter oArg.pid = object ID, and also all other parameters of method.

But it is all at your own risk - in fact there are a lot of checks before methods call. Especially for Agents...  
...
Re: (2) (2) (1) how to call object methods from javascript? 
Author:  Angelo    
Date: 24.06.2008 17:19:58
Hi Slav,
Thank you very much for your answer.

I made a small javascript code for hide my agent and all work fine

Here a example for CourseLab community:

var a = new Object;
a.pid = 'OBJ_19'
CallMethod("agent_001", "HideAgent",a);

I found the real name object in runtime.xml file.

Slav,
I have another question for you:
could you provide same code to set method parameters?

I like programming and with last request I will can completely program my course via javascript.

Thank you
Angelo  
...

Reply

You can also post this message as registered user. [Log in]
Author:
E-mail:
Subject:
Options:  Notify me if there is a new reply
Message emoticon:
Message body:
Insert smilie into text:
 
Jump to thread: