Egret 使用遇到的问题总结

一:判断对象是否已经被添加到显示列表上

1.类是否被加载到舞台:egret.Evetn.ADD_TO_STAGE      
2.判断对象是否被添加到父容器里:father.contains(child):Boolean
3.this.stage!=null (this是判断的对象类)

 二:egret调用原生js实现复制功能

//str:复制的内容
public setTextToClipboard(str: string) {
            var input = document.createElement("input");
            input.value = str;
       input.readOnly = true; //在ios上必须加上 document.body.appendChild(input); input.
select(); input.setSelectionRange(0, input.value.length), document.execCommand('Copy'); document.body.removeChild(input); // window.alert("复制成功"); EffectUtils.showTips("房间信息已经复制成功,请粘贴发送给好友"); }

猜你喜欢

转载自www.cnblogs.com/mqflive81/p/12395579.html