Warning: include() [function.include]: Unable to access /var/www/html/rogue-development/blog2/wp-content/advanced-cache.php in /var/www/html/rogue-development/blog2/wp-settings.php on line 62

Warning: include(/var/www/html/rogue-development/blog2/wp-content/advanced-cache.php) [function.include]: failed to open stream: No such file or directory in /var/www/html/rogue-development/blog2/wp-settings.php on line 62

Warning: include() [function.include]: Failed opening '/var/www/html/rogue-development/blog2/wp-content/advanced-cache.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/rogue-development/blog2/wp-settings.php on line 62

Notice: add_option was called with an argument that is deprecated since version 2.3 with no alternative available. in /var/www/html/rogue-development/blog2/wp-includes/functions.php on line 3468

Notice: register_sidebar_widget is deprecated since version 2.8! Use wp_register_sidebar_widget() instead. in /var/www/html/rogue-development/blog2/wp-includes/functions.php on line 3382

Notice: register_widget_control is deprecated since version 2.8! Use wp_register_widget_control() instead. in /var/www/html/rogue-development/blog2/wp-includes/functions.php on line 3382
Don’t center popups « Marc’s Musings

Don’t center popups

When placing popups, the Flex PopupManager class gives a great method called centerPopup. But please, don’t use that. Rarely do you actually want a popup centered. It’s often times much more visually pleasing to above there.  I like placing the top of the popup around 20% of the height of the application.

A centered popup:

A popup at 20% from the top:


Of course this isn’t a hard-set rule.  Sometimes you want your popup in other locations.  For instance, if it was triggered by a toolbar at the bottom of your application it makes no sense to force the user to mouse that far up.
Here’s a quick method to place that popup, I register my main application component on startup, but you could easily pass that in or use a stage reference instead.  This method won’t work well if you popup is too tall.

 public class PopupPositioner {  public static var mainApp:UIComponent;

  public static function centerPopUp(popup:UIComponent) : void  {   popup.x = mainApp.width / 2 - popup.width / 2;   popup.y = mainApp.height / 5;  } }

1 Response to “Don’t center popups”


  • “I register my main application component on startup, but you could easily pass that in or use a stage reference instead.”

    Please explain what you mean by that sentence.

Comments are currently closed.