getBounds bugged!!!
♥0 |
Line 28 |
Modified 2011-07-12 07:04:04 |
MIT License
archived:2017-03-20 04:16:08
ActionScript3 source code
/**
* Copyright Lorenz82 ( http://wonderfl.net/user/Lorenz82 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/eFfU
*/
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Rectangle;
/**
* ...
* @author Lorenzo Nuvoletta
*/
public class TestBounds extends Sprite
{
private var spr:Sprite;
public function TestBounds()
{
spr = new Sprite();
spr.graphics.beginFill(0xcc0000);
spr.graphics.drawCircle(0, 0, 50);
spr.graphics.endFill();
addChild(spr);
addEventListener(Event.ENTER_FRAME, onFrame);
spr.x +=100;
spr.y +=100;
}
private function onFrame(e:Event):void {
spr.rotation++;
var rect:Rectangle = spr.getBounds(this);
this.graphics.clear();
this.graphics.lineStyle(1);
this.graphics.drawRect(rect.x, rect.y, rect.width, rect.height);
}
}
}