Return to Snippet

Revision: 38545
at January 5, 2011 01:06 by adrianparr


Initial Code
function center(foreground:DisplayObject, background:DisplayObject):void
{
	foreground.x = (background.width / 2) - (foreground.width / 2);
	foreground.y = (background.height / 2) + (foreground.height / 2);
}

Initial URL
http://www.adobe.com/devnet/flash/articles/authoring_for_multiple_screen_sizes.html

Initial Description
Taken from Christian Cantrell's Adobe article called 'Authoring mobile Flash content for multiple screen sizes'.

Initial Title
AS3 Center one DisplayObject relative to another

Initial Tags
center

Initial Language
ActionScript 3