• 首页
  • 动态
  • 案例
  • 引擎社区
  • API
  • 文档
  • 示例
  • 引擎下载

大约有 4 项符合查询结果, 库内数据总量为 30,956 项。 (搜索耗时: 0.0026 秒)

1. 多个button如何区分 [ 100%]

...btn001,btn002,尾部数组为for下的i值,然后在鼠标事件的回调里去判断,当前点击的是哪个按钮 for(var i:int=0;i<10;i++) {      var btn:Button=new Button();      .......      btn.on(Event.CLICK,this,onMouse,['btn'+i]) } public function onMouse(aa):void {   ...

来源: Laya_社区 发布时间: 20170425

2. WebSocket通信 · LayaAir3.3 · 引擎文档 · LAYABOX [ 83%]

...his.socket.connectByUrl("wss://echo.websocket.org:443"); } /** 连接成功回调,发送字符串数据 */ private onSocketOpen(e: any): void { console.log("WebSocket 已连接"); // 发送字符串示例 this.socket.send("Hello, LayaAir WebSocket!"); } /** 接收数据回调 */ private onMessageR...

来源: Laya3.0_文档 发布时间: 20250314

3. HTTP通信 · LayaAir3.3 · 引擎文档 · LAYABOX [ 67%]

...送HTTP请求之后,我们直接通过异步事件的帧听,在事件回调方法里处理响应结果。完整的示例代码如下: import Event = Laya.Event; import HttpRequest = Laya.HttpRequest; const { regClass } = Laya; @regClass() export class Network_GET extends Laya.Script { private ...

来源: Laya3.0_文档 发布时间: 20250314

4. 网络通信 · LayaAir3文档 · LAYABOX [ 63%]

...sources文件夹下新建一个data.txt文件 //设置完成事件,添加回调方法 http.once(Laya.Event.COMPLETE, this, this.completeHandler); //设置错误事件,添加回调方法 http.once(Laya.Event.ERROR, this, this.errorHandler); //设置进度事件,添加回调方法 http.on(Laya.E...

来源: Laya3.0_文档 发布时间: 20250104