/** Render to sprite ( aligned 0,0 ), use sprite.x/y to position etc.
	 */
	public void applyToSprite( SwfSprite sprite ) {
		sprite.graphics.drawRectUV (material, uvRect, new Rect (0, 0, size.x, size.y));
	}
	void init(CEvent e ) {

		// Get first sprite
		SwfSprite c0 = getChildAt<SwfSprite> (0);

		// Re-create sprite 0
		container = new DisplayObjectContainer ();
		container.x = c0.x;
		container.y = c0.y;

		addChildAt (container, 0 );
		removeChild (c0);

		GraphicsDrawOP op0 = c0.graphics.drawOPs [0];
		offsetScale9Grid = new Rect (scale9Grid.x - c0.x, scale9Grid.y - c0.y, scale9Grid.width, scale9Grid.height);
		drawSize.x = op0.drawWidth;
		drawSize.y = op0.drawHeight;
		
		// Top left
		topLeftSprite = createRectTile (op0, new Rect (
			0,
			0,
			offsetScale9Grid.x,
			offsetScale9Grid.y
			));
		
		// Top Middle
		topMiddleSprite = createRectTile (op0, new Rect (
			offsetScale9Grid.x,
			0,
			offsetScale9Grid.xMax - offsetScale9Grid.x,
			offsetScale9Grid.y
			));
		
		// Top Right
		topRightSprite = createRectTile( op0, new Rect (
			offsetScale9Grid.xMax,
			0,
			op0.drawWidth-offsetScale9Grid.xMax,
			offsetScale9Grid.y
			));
		
		// Middle left
		middleLeftSprite = createRectTile ( op0, new Rect (
			0,
			offsetScale9Grid.y,
			offsetScale9Grid.x,
			offsetScale9Grid.yMax-offsetScale9Grid.y
			));
		
		// Middle middle
		middleMiddleSprite = createRectTile ( op0, new Rect (
			offsetScale9Grid.x,
			offsetScale9Grid.y,
			offsetScale9Grid.xMax-offsetScale9Grid.x,
			offsetScale9Grid.yMax-offsetScale9Grid.y
			));
		
		// Middle right
		middleRightSprite = createRectTile ( op0, new Rect (
			offsetScale9Grid.xMax,
			offsetScale9Grid.y,
			op0.drawWidth-offsetScale9Grid.xMax,
			offsetScale9Grid.yMax-offsetScale9Grid.y
			));
		
		// Bottom left
		bottomLeftSprite = createRectTile (op0, new Rect (
			0,
			offsetScale9Grid.yMax,
			offsetScale9Grid.x,
			offsetScale9Grid.y
			));
		
		// Bottom Middle
		bottomMiddleSprite = createRectTile (op0, new Rect (
			offsetScale9Grid.x,
			offsetScale9Grid.yMax,
			offsetScale9Grid.xMax - offsetScale9Grid.x,
			offsetScale9Grid.y
			));
		
		// Bottom Right
		bottomRightSprite = createRectTile( op0, new Rect (
			offsetScale9Grid.xMax,
			offsetScale9Grid.yMax,
			op0.drawWidth-offsetScale9Grid.xMax,
			offsetScale9Grid.y
			));

		// Init scale
		layoutScale9 ();
	}
	SwfSprite createRectTile( GraphicsDrawOP op, Rect localScale9Grid ) {
		SwfSprite sprite = new SwfSprite ();
		UVImage img = new UVImage (op);
		img = img.cropLocal ( localScale9Grid );
		img.applyToSprite (sprite);		
		container.addChild (sprite);
		return sprite;
	}