函数:touch() 获取对象

函数功能:返回一个对象,通过此变量进行滑动操作

TSLib 版本:仅支持 v1.2.7 及其以上版本

函数方法

local touch = touch(index)

参数 类型 必填 说明
index number 手指序号,仅支持函数库 v1.3.0 及其以上版本
默认不写随机手指序号,推荐使用 0 - 29

函数用例

--此函数为触动精灵专用函数请勿用于积木编程
--使用本函数库必须在脚本开头引用并将文件放到设备 lua 目录下
--touch 函数仅支持 V1.2.7 以上版本 TSLib  
require "TSLib"--使用本函数库必须在脚本开头引用并将文件放到设备 lua 目录下
tsver = TSVersions()     
tsint = tonumber(string.sub(tsver,1,1)..string.sub(tsver,3,3)..string.sub(tsver,5,5));
if tsint < 127 then
    dialog("TSLib 版本低,请下载最新版本的 TSLib 导入到lua文件夹下")
    luaExit()
end
--index 参数仅支持函数库 v1.3.0 及其以上版本 TSLib
local touch = touch() 
touch:on(100,100):move(100,100):off()

注意事项

  • 安卓设备点击、滑动函数无效可以换此函数再试下

  • 此函数为触动精灵专用函数请勿用于积木编程

Copyright 北京帮你玩科技有限公司 2023 all right reserved,powered by Gitbook该文章修订时间: 2024-03-06 17:50:18

results matching ""

    No results matching ""