我正在关注Adobe关于检测屏幕尺寸的教程。我正在努力使屏幕最适合IOS和Android设备。
这是一个很棒的教程,我得到了代码:http://www.adobe.com/devnet/air/articles/multiple-screen-sizes.html
但是,当我使用术语“base”时,正如他们在本教程中所建议的那样,我收到以下错误。 1120:访问未定义的属性库。
以下是我收到错误的代码:
// scale the entire interface
base.scale = appScale;
// map stays at the top left and fills the whole screen
base.map.x = 0;
这是我在函数中使用的代码,减去包中两个vars的声明。
public function theScreen()
{
guiSize = new Rectangle(0,0,1024,600);
deviceSize = new Rectangle(0,0,Math.max(stage.fullScreenWidth,stage.fullScreenHeight),Math.min(stage.fullScreenWidth,stage.fullScreenHeight));
W.text = "" + deviceSize.width + "";
H.text = "" + deviceSize.height + "";
var appScale:Number = 1;
var appSize:Rectangle = guiSize.clone();
var appLeftOffset:Number = 0;
// if device is wider than GUI's aspect ratio, height determines scale
if ((deviceSize.width/deviceSize.height) > (guiSize.width/guiSize.height))
{
appScale = deviceSize.height / guiSize.height;
appSize.width = deviceSize.width / appScale;
appLeftOffset = Math.round((appSize.width - guiSize.width) / 2);
}
else
{
appScale = deviceSize.width / guiSize.width;
appSize.height = deviceSize.height / appScale;
appLeftOffset = 0;
}
// scale the entire interface
base.scale = appScale;
// map stays at the top left and fills the whole screen
base.map.x = 0;
}
如何访问Adobe所指的“基础”类?