www-flextras.comが提案しているように、このようなクラスを使用して、アラートメッセージを配置するためのロジックを配置できます。
CREATION_COMPLETE
アラートの位置を設定する前に、イベントを待つ必要があります。_alert.move(_nextX, _nextY)
次の例でも使用できることに注意してください。
package
{
import flash.display.Sprite;
import mx.controls.Alert;
import mx.core.IFlexModuleFactory;
import mx.events.FlexEvent;
public class MyAlertFactory
{
private static const MAX_WIDTH:uint = 320;
private static const MAX_HEIGHT:uint = 280;
private static var _nextX:int = 0;
private static var _nextY:int = 0;
public static function show(text:String, title:String = "",
flags:uint = 4, parent:Sprite = null,
closeHandler:Function = null,
iconClass:Class = null,
defaultButtonFlag:uint = 4,
moduleFactory:IFlexModuleFactory = null):Alert {
var alert:Alert = Alert.show(text, title, flags, parent,
closeHandler, iconClass, defaultButtonFlag, moduleFactory);
alert.addEventListener(FlexEvent.CREATION_COMPLETE, handleAlertCreation);
return alert;
}
private static function handleAlertCreation(event:FlexEvent):void
{
_nextX = (_nextX + 20) % MAX_WIDTH;
_nextY = (_nextY + 15) % MAX_HEIGHT;
var alert:Alert = Alert(event.currentTarget);
alert.x = _nextX;
alert.y = _nextY;
alert.removeEventListener(FlexEvent.CREATION_COMPLETE, handleAlertCreation);
}
}