In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

forked from: getBounds bugged!!!

...
@author Lorenzo Nuvoletta
Get Adobe Flash player
by shapevent 14 Jul 2011
    Embed
/**
 * Copyright shapevent ( http://wonderfl.net/user/shapevent )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/iQhs
 */

// forked from Lorenz82's getBounds bugged!!!
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.getRect(this);
            this.graphics.clear();
            this.graphics.lineStyle(1);
            this.graphics.drawRect(spr.x, spr.y, rect.width, rect.height);
        }
        
    }

}