你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
搜索:
没有找到相关结果
cuixueying
赞同来自: ethan
package { import laya.display.Stage; import laya.ui.Button; import laya.ui.Dialog; import laya.ui.Image; import laya.utils.Handler; import laya.webgl.WebGL; public class DialogCenterClose { private const DIALOG_WIDTH:int = 220; private const DIALOG_HEIGHT:int = 275; private const CLOSE_BTN_WIDTH:int = 43; private const CLOSE_BTN_PADDING:int = 5; private var assets:Array; public function DialogCenterClose() { // 不支持WebGL时自动切换至Canvas Laya.init(800, 600, WebGL); Laya.stage.alignV = Stage.ALIGN_MIDDLE; Laya.stage.alignH = Stage.ALIGN_CENTER; Laya.stage.scaleMode = Stage.SCALE_SHOWALL; Laya.stage.bgColor = "#eeffcc"; UIConfig.closeDialogOnSide=false;//在dialog显示之前提前设置 assets = ["res/ui/dialog (1).png", "res/ui/close.png"]; Laya.loader.load(assets, Handler.create(this, onSkinLoadComplete)); } private function onSkinLoadComplete(e:*=null):void { var dialog:Dialog = new Dialog(); var bg:Image = new Image(assets[0]); dialog.addChild(bg); var button:Button = new Button(assets[1]); button.name = Dialog.CLOSE; button.pos(DIALOG_WIDTH - CLOSE_BTN_WIDTH - CLOSE_BTN_PADDING, CLOSE_BTN_PADDING); dialog.addChild(button); dialog.dragArea = "0,0," + DIALOG_WIDTH + "," + DIALOG_HEIGHT; dialog.popup(); } } }
赞同来自:
要回复问题请先登录
2 个回复
cuixueying
赞同来自: ethan
cuixueying
赞同来自: