You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2019/11/21 00:39:15 UTC
[royale-asjs] branch develop updated: center mx Alert. Fixes #565
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
View the commit online:
https://github.com/apache/royale-asjs/commit/ad120ad26c21475dcd79712ee9d696014c44eecd
The following commit(s) were added to refs/heads/develop by this push:
new ad120ad center mx Alert. Fixes #565
ad120ad is described below
commit ad120ad26c21475dcd79712ee9d696014c44eecd
Author: Alex Harui <ah...@apache.org>
AuthorDate: Wed Nov 20 16:38:59 2019 -0800
center mx Alert. Fixes #565
---
.../MXRoyale/src/main/royale/mx/controls/Alert.as | 40 +++++++++++++++++-----
1 file changed, 32 insertions(+), 8 deletions(-)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Alert.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Alert.as
index 609bca2..a49af67 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Alert.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Alert.as
@@ -20,15 +20,21 @@
package mx.controls
{
+ import flash.events.EventPhase;
+
+ import mx.containers.Panel;
+ import mx.core.FlexGlobals;
+ import mx.core.IFlexDisplayObject;
+ import mx.core.IUIComponent;
+ import mx.events.FlexEvent;
+ import mx.managers.ISystemManager;
+ import mx.managers.PopUpManager;
+
import org.apache.royale.core.IAlertModel;
import org.apache.royale.core.IChild;
- import org.apache.royale.events.Event;
- import org.apache.royale.events.CloseEvent;
- import mx.containers.Panel;
- import mx.managers.ISystemManager;
- import mx.managers.PopUpManager;
- import mx.core.IUIComponent;
- import mx.core.FlexGlobals;
+ import org.apache.royale.events.CloseEvent;
+ import org.apache.royale.events.Event;
+
/*
import flash.events.Event;
import flash.events.EventPhase;
@@ -519,13 +525,31 @@ public class Alert extends Panel
alert.document = FlexGlobals.topLevelApplication.document;
}
- alert.addEventListener(FlexEvent.CREATION_COMPLETE, static_creationCompleteHandler);
*/
+
+ alert.addEventListener(FlexEvent.CREATION_COMPLETE, static_creationCompleteHandler);
+
PopUpManager.addPopUp(alert, parent, true);
return alert;
}
+ /**
+ * @private
+ */
+ private static function static_creationCompleteHandler(event:FlexEvent):void
+ {
+ if (event.target is Alert /*IFlexDisplayObject && event.eventPhase == EventPhase.AT_TARGET*/)
+ {
+ var alert:Alert = Alert(event.target);
+ alert.removeEventListener(FlexEvent.CREATION_COMPLETE, static_creationCompleteHandler);
+
+ //alert.setActualSize(alert.getExplicitOrMeasuredWidth(),
+ // alert.getExplicitOrMeasuredHeight());
+ PopUpManager.centerPopUp(IFlexDisplayObject(alert));
+ }
+ }
+
//--------------------------------------------------------------------------
//
// Constructor