Tweening RoundRect rectangles... help!

Hi guys,

I posted about this a while ago but didn’t get a response and as It wasn’t crucial I didn’t bother bumping it… but now I’m kinda stuck :slight_smile:
So if anyone could help me with this??

Basically I need to tween (with TweenLite/Tweener) a dynamically drawn rounded rectangle (via RoundRect) to different sizes so that it keeps its scaling (ie the rounded corners don’t stretch out)… I presume I could do it with onEnterframe so that the movieclip would keep on drawing until the specified size was met, but I have know idea how to do it…

Thanks

Liam

public static  const BORDER:Number=10;
protected var _finX:Number=0,_finY:Number=0;
protected var changed:Boolean=true;
public function set finX(value:Number):void {
	if (value<0) value=0;
	if (value!=this._finX) {
		this._finX=value;
		this.changed=true;
	}
}
public function get finX():Number {
	return this._finX;
}
public function set finY(value:Number):void {
	if (value<0) value=0;
	if (value!=this._finY) {
		this._finY=value;
		this.changed=true;
	}
}
public function get finY():Number {
	return this._finY;
}
public function draw():void {
	if (this.changed) {
		_draw();
		this.changed=false;
	}
}
private function _draw():void {
	this.graphics.clear();
	this.graphics.lineStyle(1,0x000000);
	this.graphics.beginFill(0xFF3366);
	this.graphics.moveTo(- BORDER,0);
	this.graphics.curveTo(- BORDER,- BORDER,0,- BORDER);
	this.graphics.lineTo(this._finX,- BORDER);
	this.graphics.curveTo(this._finX + BORDER,- BORDER,this._finX + BORDER,0);
	this.graphics.lineTo(this._finX + BORDER,this._finY);
	this.graphics.curveTo(this._finX + BORDER,this._finY + BORDER,this._finX,this._finY + BORDER);
	this.graphics.lineTo(0,this._finY + BORDER);
	this.graphics.curveTo(- BORDER,this._finY + BORDER,- BORDER,this._finY);
}
TweenLite.to(event.target, 2.66, {x:100,y:100,finX:100,finY:100,ease:Elastic.easeOut,onUpdate:event.target.draw,overwrite:false});

scale9Grid was made for just such a thing…

Sorry guys, been away a few days…

Thanks for the example Felixz :slight_smile: - I actually came to something like that… but using onEnterFrame and just tweened the properties - worked a treat!

Devonair - Agreed, but sadly scale9gride doesn’t work if the mc is used as a mask… :slight_smile: p.s. Thank you so much for your basic as3 site tutorials - they were a huge help in learning AS3.

Liam