日期:2014-05-16  浏览次数:20281 次

Laszlo与Javascript通信的实现

在我们的视频会议系统编程过程中,免不了在laszlo中调用Javascript,而其中参数大多来源于网页信息,作为我们示例程序,我们在视频会议室Flash界面里实现查看当前与会者名单列表的详细,其中信息数据从服务器中拉取,最终实现的效果如下:

?


如何来实现呢,首先编写界面程序,加入一行laszlo:

?

?

<_labelMenuItem text="与会者列表信息" command="cmd_vms_viewallmeetings" />

?

?

然后编写其事件,代码如下:

?

?

var initroomid = lz.Browser.getInitArg('roomid');
lz.Browser.callJS('Faqee_vms.viewOnline',null,initroomid);

?

?

首先从网页中得到房间ID,继而利用lz.BrowserService来调用网页中的js函数,如果该js函数有返回值,利用第二个参数执行回调,以下是官方的具体调用API说明:

?

?

callJS()
lz.BrowserService.callJS(methodname?:?String,?callback?:?Function,?args);
Runs a Javascript method in the browser, optionally returning the result. Note that this feature requires the application to be embedded by the embed-compressed.js library.
Parameter Name Type Description
methodname String Browser javascript method name to execute
callback Function Optional callback function to receive the return value of the javascript call

args

?

?

?

?

查看最终项目效果可登陆:http://t.faqee.c