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

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

21. 2D物理-碰撞过滤器 [ 86%]

...x(posx, posy, width, height, ratio) { var box = new Sprite(); box.on(Event.MOUSE_DOWN, this, this.mouseDown); Laya.stage.addChild(box); box.pos(posx, posy).size(width * ratio, height * ratio); var rigidbody: RigidBody = box.addComponent(RigidBody); rigidbody.category = Physics_Physics_CollisionFilte...

来源: Laya2.0_示例 发布时间: 20240929

22. tab 是否可以做到左右滑动切换view呢? [ 85%]

...享 微博 QZONE 微信 asdf131 赞同来自: { this.on(laya.events.Event.MOUSE_DOWN ,this, this.onMouseDown);         this.on(laya.events.Event.MOUSE_UP ,this, this.onMouseUp);              }     private onMouseDownX : number;     private onMouseDownY : number;     private i...

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

23. 文本-滚动文本 [ 85%]

...00"; this.txt.fontSize = 20; this.txt.color = "#ffffff"; this.txt.on(Event.MOUSE_DOWN, this, this.startScrollText); } /* 开始滚动文本 */ startScrollText(e) { const Event = Laya.Event; prevX = this.txt.mouseX; prevY = this.txt.mouseY; Laya.stage.on(Event.MOUSE_MOVE, this, this.scrollText); Laya...

来源: Laya2.0_示例 发布时间: 20240929

24. sprite点击事件 位置便宜 [ 85%]

...a = hitArea; Laya.stage.addChild(rect); //增加鼠标事件 rect.on(Event.MOUSE_DOWN, this, mouseHandler); rect.on(Event.MOUSE_UP, this, mouseHandler); rect.on(Event.CLICK, this, mouseHandler); rect.on(Event.RIGHT_MOUSE_DOWN, this, mouseHandler); rect.on(Event.RIGHT_MOUSE_UP, this, mouseHandler); r...

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

25. 文本-滚动文本 [ 85%]

...ntSize = 20; txt.color = "#ffffff"; Laya.stage.addChild(txt); txt.on(Event.MOUSE_DOWN, this, startScrollText); } /* 开始滚动文本 */ function startScrollText(e) { prevX = txt.mouseX; prevY = txt.mouseY; Laya.stage.on(Event.MOUSE_MOVE, this, scrollText); Laya.stage.on(Event.MOUSE_UP, this, finis...

来源: Laya_示例 发布时间: 20240929

26. MOUSE_UP事件 [ 85%]

...E_UP事件 当我使用 for(var i=0;i<3;i++){ this["_role_"+i].on(Event.MOUSE_DOWN,this,this.clickDown) ; this["_role_"+i].on(Event.MOUSE_MOVE,this,this.clickMove); // this["_role_"+i].on(Event.MOUSE_UP,this,this,clickUp); }这样的方式添加监听时,MOUSE_UP不支持对象采用拼接的...

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

27. 图片像素精准点击问题! [ 84%]

...区域,这里不能用 on(Laya.Event.CLICK,只能通过 on(Laya.Event.MOUSE_DOWN 来检测。   下面是我的代码处理: class demo { private down:Laya.Image; constructor() { // 鼠标事件 Laya.stage.on(Laya.Event.MOUSE_DOWN, this, this.onMouseDown); Laya.stage.on(Laya.Event.MOUSE_MOVE,...

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

28. on和off的bug [ 84%]

...n和off的bug 是这样的,我写了类似这样的代码a.on(Laya.Event.MOUSE_DOWN, this, onStartDrag); 之后我想去掉拖动,就写了a.off(Laya.Event.MOUSE_DOWN, this, onStartDrag); 但发现不行,于是我改成a.offAll(); 就可以了。 需要说明的是onStartDrag是函数内定义...

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

29. 鼠标交互-拖动 [ 84%]

...aya.stage.width / 2; this.ape.y = Laya.stage.height / 2; this.ape.on(Event.MOUSE_DOWN, this, this.onStartDrag); } showDragRegion() { const Rectangle = Laya.Rectangle; //拖动限制区域 let dragWidthLimit = 350; let dragHeightLimit = 200; dragRegion = new Rectangle(Laya.stage.width - dragWidthLimi...

来源: Laya2.0_示例 发布时间: 20240929

30. 鼠标交互-拖动 [ 84%]

... ape.x = Laya.stage.width / 2; ape.y = Laya.stage.height / 2; ape.on(Event.MOUSE_DOWN, this, onStartDrag); } function showDragRegion() { //拖动限制区域 var dragWidthLimit = 350; var dragHeightLimit = 200; dragRegion = new Rectangle(Laya.stage.width - dragWidthLimit >> 1, Laya.stage.height - dr...

来源: Laya_示例 发布时间: 20240929