在stage.stageWidth
上尝试stageHeight
和applicationComplete
,但由于某种原因,返回的实际数字似乎不准确 - 图片始终显示为偏心(stageWidth / 2 - imageWidth / 2)。
如何确定移动设备的实际屏幕尺寸,使对象居中?
答案 0 :(得分:4)
你试过了吗?
popUp.width = FlexGlobals.topLevelApplication.width - 40; //popup - leave side edges
popUp.height = FlexGlobals.topLevelApplication.height - 40; //popup - leave top + bottom edges
popUp.x = FlexGlobals.topLevelApplication.width/2 - popUp.width/2; //popup x coord
popUp.y = FlexGlobals.topLevelApplication.height/2 - popUp.height/2; //popup y coord