По крайней мере, вы можете использовать debug_backtrace и проанализировать его, чтобы найти вызывающий метод.
Я думаю, что вы также должны быть в состоянии сделать это с помощью API отражения , но прошло слишком много времени с тех пор, как я использовал PHP, и я точно не помню, как именно. Однако ссылки должны, по крайней мере, помочь вам начать.
Если вы хотите повернуть объект вокруг центра, просто отцентрируйте ресурс внутри вашего спрайта, установив параметр внутренние активы x и y равны половине ширины и высоты актива. Это позволит центрировать ваш контент и позволить ему вращаться вокруг центральной точки.
Пример загруженных ресурсов во время выполнения выглядит следующим образом:
var loader:Loader = new Loader():
var request:URLRequest = new URLRequest(path/to/asset.ext);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, _onLoaderComplete);
loader.load(request);
private function _onLoaderComplete(e:Event):void
{
var mc:MovieClip = e.target.content as MovieClip;
mc.x = -mc.width * 0.5;
mc.y = -mc.height * 0.5;
mc.rotation = 90;
addChild(mc);
}
The following steps are required to rotate objects based on a reference point (using Matrix object and getBounds):
For example to rotate an object 90 degrees around its center:
// Get the matrix of the object
var matrix:Matrix = myObject.transform.matrix;
// Get the rect of the object (to know the dimension)
var rect:Rectangle = myObject.getBounds(parentOfMyObject);
// Translating the desired reference point (in this case, center)
matrix.translate(- (rect.left + (rect.width/2)), - (rect.top + (rect.height/2)));
// Rotation (note: the parameter is in radian)
matrix.rotate((90/180)*Math.PI);
// Translating the object back to the original position.
matrix.translate(rect.left + (rect.width/2), rect.top + (rect.height/2));
Key methods used: