白鹭学习笔记1

// 创建背景图

let bg:egret.Bitmap = new egret.Bitmap();
bg.texture = RES.getRes("bg_jpg");
this.addChild(bg);
let stageW = this.stage.stageWidth;
let stageH = this.stage.stageHeight;
bg.width=stageW;
bg.height=stageH;

private _txInfo:egret.TextField;
private _bgInfo:egret.Shape;

文本信息

this._txInfo = new egret.TextField;
this.addChild( this._txInfo );

this._txInfo.size = 28;
this._txInfo.x = 50;
this._txInfo.y = 50;
this._txInfo.textAlign = egret.HorizontalAlign.LEFT;
this._txInfo.textColor = 0x000000;
this._txInfo.type = egret.TextFieldType.DYNAMIC;
this._txInfo.lineSpacing = 6;
this._txInfo.multiline = true;

this._txInfo.text = "轻触屏幕调整显示对象位置";

this._bgInfo = new egret.Shape;
this.addChildAt( this._bgInfo, this.numChildren - 1 );

this._bgInfo.x = this._txInfo.x;
this._bgInfo.y = this._txInfo.y;
this._bgInfo.graphics.clear();
this._bgInfo.graphics.beginFill( 0xff0000, 0.5 );
this._bgInfo.graphics.drawRect( 0, 0, this._txInfo.width, this._txInfo.height );
this._bgInfo.graphics.endFill();

猜你喜欢

转载自www.cnblogs.com/kuainiao/p/9355894.html