Created
January 28, 2013 15:09
-
-
Save tmshv/4656211 to your computer and use it in GitHub Desktop.
Создает спрайт, помещает переданный объект внутрь этого спрайта, сам объект центрует
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ru.gotoandstop.display { | |
import flash.display.DisplayObject; | |
import flash.display.Sprite; | |
public function createSpriteWithCentredContent(content:DisplayObject):Sprite { | |
var s:Sprite = new Sprite(); | |
content.x = -int(content.width / 2); | |
content.y = -int(content.height / 2); | |
s.addChild(content); | |
return s; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment