Cuando creamos contenido para móviles nos podemos encontrar en muchos casos con terminales que pueden tener varias orientaciones, momento en el cual cambia la posición de las SoftKeys.
Para ello nosotros podemos hacer uso de un fscommand2 (la función específica de Flash Lite para acceder a propiedades del terminal) que nos devuelve la posición de las SoftKeys y con ello armarnos un método que nos controle el posicionamiento automáticamente.
En este ejemplo he creado dos clips de película con nombre de instancia softLeft y softRight para posicionarlos según su localización real.
Código :
var screenPos:Number;
fscommand2("FullScreen", true);
Stage.scaleMode = "noScale";
Stage.align = "TL";
Stage.addListener(this);
function onResize():Void
{
screenPos = fscommand2("GetSoftKeyLocation");
switch (screenPos)
{
case 0:
//TOP
softLeft._x = 0;
softLeft._y = 0;
softRight._x = Stage.width - softRight._width;
softRight._y = 0;
break;
case 1:
//LEFT
softLeft._x = 0;
softLeft._y = Stage.height - softLeft._height;
softRight._x = 0;
softRight._y = Stage.height - softRight._height;
break;
case 2:
//BOTTOM
softLeft._x = 0;
softLeft._y = Stage.height - softLeft._height;
softRight._x = Stage.width - softRight._width;
softRight._y = Stage.height - softRight._height;
break;
case 3:
//RIGHT
softLeft._x = Stage.width - softLeft._width;
softLeft._y = Stage.height - softLeft._height;
softRight._x = Stage.width - softRight._width;
softRight._y = 0;
break;
}
}