熱門文章

Ⓔeui.UIEvent 用法

Panel UIEvent 註冊

MainUISkin.exml
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="edwin.MainUISkin" xmlns:e="http://ns.egret.com/eui">
    <e:Rect fillColor="0x000000" width="100%" height="100%" />
    <e:Group horizontalCenter="0" verticalCenter="0">
        <e:Panel id="panel" title="test" />
    </e:Group>
</e:Skin>
MainUI.ts
namespace edwin {

    export class MainUI extends eui.Component {

        private panel: eui.Panel;

        protected createChildren(): void {
            super.createChildren();
            this.percentWidth = this.percentHeight = 100;

            this.panel.addEventListener(eui.UIEvent.CLOSING, this.onUIEventHandler, this);
            this.panel.addEventListener(eui.UIEvent.MOVE, this.onUIEventHandler, this);
        }

        private onUIEventHandler(e: eui.UIEvent): void {
            egret.log("eui.UIEvent:", e.type);
        }

    }

}

Panel 完整用法參考:eui.Panel 用法

沒有留言:

張貼留言