Egret custom skin - introduced class

 

After creating the project egret games you need to create a lot of skin EXML files, create EXML embedded in the code: (similar to JSON)

  • The first text embedded directly EXML code
  • Directly to the skinName set the path for the exml file.
class ExmlTestView extends eui.Component{
    public constructor() {
        super();
        this.addEventListener(eui.UIEvent.COMPLETE,this.onComplete,this);
        this.skinName = "xxxx(.exml)";
        this.touchChildren = true;
    }

    public label: eui.Label;

    private onComplete() {
        this.label.text = "hello world!";
        this.label.textColor = 0xff0000;
    }
    
    // the createChildren (): used to manually call to create an unbound skin to skin the contents of the interface
     // childrenCreated (): Once created the underlying calls this function to cover writing some initialization process (in assembly after initialization callback)
    private createChildren() {
    
        super.createChildren();
    
    }
}

 

Guess you like

Origin www.cnblogs.com/mqflive81/p/11233632.html