Agent插件浅析(5) 应用程序对象; 3、新建窗口对象w_example,并在其上放置控件如下表: 控件 控件名称 listbox lb_1 commandbutton cb_1 commandbutton cb_2 ole control ole_1(并插入对应的Agent ActiveX控件) 4、新建菜单对象m_file,并添加相关菜单项如下表: 菜单名 菜单文本 菜单脚本 m_file 文件(&F) m_fileopen 打开(&O) parentwindow.triggerevent("ue_fileopen") m_bar1 - m_fileexit 退出(&E) parentwindow.triggerevent("ue_fileexit") 5、将窗口对象w_example的menuid属性设置为m_file 6、定义窗口w_example的实例变量如下: privite: boolean ib_flag string is_animationname 7、编写窗口w_example相关事件脚本: open事件脚本如下: long result,ll if fileexists(GetCurrentDirectory ( )+"\peedy.acs")=false then result=messagebox("提示“,"在程序当前目录下没有动画角色文件",stop!) ib_flag=false close(this) else ib_flag=true ole_1. O B J E C T.characters.load("CharacterID",GetCurrentDirectory ( )+"\peedy.acs") ole_1. O B J E C T.characters("CharacterID").languageID=1033 ole_1. O B J E C T.characters("CharacterID").moveto(20,20) ole_1. O B J E C T.characters("CharacterID").show() ole_1. O B J E C T.characters("CharacterID").play("Wave") ole_1. O B J E C T.characters("CharacterID").speak("Hello,Welcome to use The Character Animation Previewer Programm!") ole_1. O B J E C T.characters("CharacterID").play("Reading") lb_1.reset() for ll=1 to upperbound(ole_1. O B J E C T.characters("CharacterID").animationnames) lb_1.additem(ole_1. O B J E C T.characters("CharacterID").animationnames[ll]) next lb_1.selectitem(1) close事件脚本如下: if ib_flag=true then