0

我将如何在 Adob​​e Flex 移动设备中查找舞台或导航区域的显示尺寸和位置?我希望能够制作出精确的宽度和高度(不使用 100% w&h)。并将顶部放置在舞台的顶部。我确信这个描述不是最容易理解的,所以希望这张图片会有所帮助:

应用布局

        protected function init(event:FlexEvent):void
        {
            if (NativeMaps.isSupported){
                NativeMaps.service.addEventListener(Event.ACTIVATE, mapReady2);
                //NativeMaps.service.addEventListener(NativeMapEvent.MAP_CREATED, mapReady);                    
                try{
                    NativeMaps.service.mapOptions.compassEnabled=true;
                    NativeMaps.service.mapOptions.zoomControlsEnabled = true;
                    NativeMaps.service.mapOptions.zoomGesturesEnabled = true;
                    NativeMaps.service.mapOptions.rotateGesturesEnabled = true;
                    NativeMaps.service.mapOptions.myLocationButtonEnabled = true;
                }catch(e:Error){
                }
                var tla:ViewNavigatorApplication=FlexGlobals.topLevelApplication as ViewNavigatorApplication;                   
                var width:Number = tla.width;
                var height:Number = tla.height-tla.actionBar.height;
                var x:Number = 0;
                var y:Number = tla.actionBar.height;

                NativeMaps.service.createMap(width,height,x,y);
            }
        }
4

1 回答 1

1

我认为这是你需要的:

var tla :ViewNavigatorApplication = FlexGlobals.topLevelApplication as ViewNavigatorApplication;
var width :Number = tla.width;
var height :Number = tla.height=tla.actionBar.height;
var x :Number = 0;
var y :Number = tla.actionBar.height;

然后使用宽度和高度调整组件的大小,并使用 x 和 y 值定位它。我是在浏览器中写的,所以希望代码中出现拼写错误。可能有一些填充问题会使尺寸/位置略有偏差,但您必须尝试一下,看看您会得到什么。

于 2013-10-11T16:41:42.580 回答