Android as3什么是base以及如何调用base.scale
我正在遵循Adobe关于检测屏幕大小的教程。我正在努力使屏幕最适合IOS和Android设备 这是一个很棒的教程,我从中获得了代码: 然而,当我使用术语“base”时,正如他们在本教程中建议的那样,我得到了以下错误。 1120:访问未定义的属性库。 下面是我得到错误的代码:Android as3什么是base以及如何调用base.scale,android,ios,actionscript-3,air,Android,Ios,Actionscript 3,Air,我正在遵循Adobe关于检测屏幕大小的教程。我正在努力使屏幕最适合IOS和Android设备 这是一个很棒的教程,我从中获得了代码: 然而,当我使用术语“base”时,正如他们在本教程中建议的那样,我得到了以下错误。 1120:访问未定义的属性库。 下面是我得到错误的代码: // scale the entire interface base.scale = appScale; // map stays at the top left and fills the whole screen b
// scale the entire interface
base.scale = appScale;
// map stays at the top left and fills the whole screen
base.map.x = 0;
下面是我在函数中使用的代码,减去包中两个变量的声明
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所指的“base”类?在本例中,base只是“container”MovieClip的实例名,因为我猜所有DispalyObject项都集中在其中。你只是在舞台上没有这样一个项目(movieClip带有ibstance名称-base),hance AS3找不到它。但是,我在adobe代码中没有看到它,所以我想知道。可能是