Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 19th, 2010 | Syntax: ActionScript 3 | Size: 0.77 KB | Hits: 53 | Expires: Never
Copy text to clipboard
  1. package
  2. {
  3.         import flash.display.Sprite;
  4.         import flash.display.DisplayObject;
  5.         import flash.geom.Rectangle;
  6.  
  7.         public class CustomBoundSprite extends Sprite
  8.         {
  9.                 private var customBound:Rectangle = new Rectangle();
  10.                 private var customBoundObject:DisplayObject;
  11.                 public function CustomBoundSprite()
  12.                 {
  13.                         super();
  14.                 }
  15.                 public function set bound(targetBound:DisplayObject):void
  16.                 {
  17.                         customBoundObject=targetBound
  18.                         customBound = targetBound.getBounds(targetBound.parent);
  19.        
  20.                 }
  21.                 public function get custBound():Rectangle
  22.                 {
  23.                         customBound = customBoundObject.getBounds(customBoundObject.parent);
  24.                         return customBound
  25.                 }
  26.                 override public function getBounds(targetCoordinateSpace:DisplayObject):Rectangle {
  27.                  
  28.                  
  29.                         return customBound
  30.                 }
  31.                
  32.         }
  33. }