Untitled
By: a guest | Mar 19th, 2010 | Syntax:
ActionScript 3 | Size: 0.77 KB | Hits: 53 | Expires: Never
package
{
import flash.display.Sprite;
import flash.display.DisplayObject;
import flash.geom.Rectangle;
public class CustomBoundSprite extends Sprite
{
private var customBound:Rectangle = new Rectangle();
private var customBoundObject:DisplayObject;
public function CustomBoundSprite()
{
super();
}
public function set bound(targetBound:DisplayObject):void
{
customBoundObject=targetBound
customBound = targetBound.getBounds(targetBound.parent);
}
public function get custBound():Rectangle
{
customBound = customBoundObject.getBounds(customBoundObject.parent);
return customBound
}
override public function getBounds(targetCoordinateSpace:DisplayObject):Rectangle {
return customBound
}
}
}