AS3使一个显示对象相对于另一个显示对象居中

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AS3使一个显示对象相对于另一个显示对象居中相关的知识,希望对你有一定的参考价值。

Taken from Christian Cantrell's Adobe article called 'Authoring mobile Flash content for multiple screen sizes'.
  1. function center(foreground:DisplayObject, background:DisplayObject):void
  2. {
  3. foreground.x = (background.width / 2) - (foreground.width / 2);
  4. foreground.y = (background.height / 2) + (foreground.height / 2);
  5. }

以上是关于AS3使一个显示对象相对于另一个显示对象居中的主要内容,如果未能解决你的问题,请参考以下文章