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

大约有 191 项符合查询结果, 库内数据总量为 31,671 项。 (搜索耗时: 0.0037 秒)

1. destroy节点后,报错 [ 100%]

...舞台移除模型对象 @param node 节点 */ base_remove(node){ if(node.numChildren<=0)return; console.log('移除',node.name); let obj; for(let i=node.numChildren-1;i>=0;i--){ obj= node.getChildAt(i); obj.destroy(); } }   或者 /* 从舞台移除模型对象 @param node 节点 */ base_rem...

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

2. 获取不到父物体 节点 [ 93%]

...le.log("startScene"); console.log(Laya.stage.name); console.log(Laya.stage.numChildren); console.log(this.numChildren); console.log(this.parent); console.log(this.name); } }这个同样是null export default class game_mgr extends Laya.Script { constructor() { super(); console.log(this.owner); } } ...

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

3. 父容器怎么知道有子对象添加了进来呢 [ 92%]

... 1 个回复 Monica - 知识达人 赞同来自: 你可以通过父节点.numChildren()来获取它里边当前子节点的数量 2017-11-04 0 2 分享 微博 QZONE 微信 为什么被折叠? 0 个回复被折叠 要回复问题请先登录 发起人 zeorro 相关问题 两个对象new了一个相...

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

4. 飞机大战实例js版本 [ 87%]

飞机大战实例js版本 for(var i=Laya.stage.numChildren-1;i>0;i--) 遍历所有飞机,为什么i>0 ,这样不是取不到索引为0的飞机了吗?但预览效果为什么又是对的呢? 期待回复,谢谢。 2018-02-07 添加评论 免费帖 --> 分享 微博 QZONE 微信 没...

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

5. 当屏幕尺寸,缩放模式,横竖屏 发生改变时会报错Uncaught TypeError: Cannot read property 'length' of null [ 86%]

...,当destroy函数调用时会把子节点销毁,所以public function get numChildren(){} 被调用时child为空 所以报错,算是引擎的bug吧,将原函数改为public function get numChildren():int {             trace(this);             if (!this._childs){           ...

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

6. 关于removeChildren、 destroy和destroyChildren的疑惑 [ 82%]

...adSprite; }());然后如此使用destroy for (var i = 0; i < Laya.stage.numChildren; i++) { var object = Laya.stage.getChildAt(i); // object.removeSelf(); Laya.stage.removeChildAt(i); object.destroy(true); }该对象继续在屏幕上显示。。。(IDE版本1.7.10.bate) 使用Laya.stage.dest...

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

7. 为什么会出现报错 ani not found:ufo1_down [ 82%]

...Loop() { // 遍历所有飞机,更改飞机状态 for(var i = Laya.stage.numChildren - 1; i > 0; i--) { // 接收舞台子对象 var role = Laya.stage.getChildAt(i); // 判断是否有飞机,并且是否有速度值 if(role && role.speed){ // 根据飞机速度更改飞机的位置 ro...

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

8. 鼠标穿透问题 [ 81%]

...tected function removeAllChildren(container:Sprite):void { while(container.numChildren > 0) { container.removeChildAt(0); } } protected function createLoading():Sprite { _loadingBg = new Sprite(); _loadingBg.graphics.drawRect(0, 0, _list.width, _list.height, "#000000"); _loadingBg.alpha = .7; _lo...

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

9. 自定义对话框设置zOrder后,关闭时报错 [ 81%]

...是一个继承自laya.ui.Dialog的对象,设置this.zOrder = 100;导致numChildren异常,关闭时报错。 开发者往往并不能确定确切的zOrder值,可能预设一个较大的值,如果这值不合规范,应该在接受这个值以后自动调整; 个人认为这是框架应该...

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

10. 为什么会出现报错 ani not found:ufo1_down [ 80%]

...Loop() { // 遍历所有飞机,更改飞机状态 for(var i = Laya.stage.numChildren - 1; i > 0; i--) { // 接收舞台子对象 var role = Laya.stage.getChildAt(i); // 判断是否有飞机,并且是否有速度值 if(role && role.speed){ // 根据飞机速度更改飞机的位置 ro...

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