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
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…
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);
}
Thanks for the example Felixz - 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… p.s. Thank you so much for your basic as3 site tutorials - they were a huge help in learning AS3.