Tuesday December 18th 2007, 1:37 pm
Filed under: Flash
Filed under: Flash
Hace poco he tenido que crear esta función en el trabajo para crear un cuadrado con esquinas redondeadas.
Actionscript:
-
crearMarco(10, 10, Stage.width-20, Stage.height-20, 10, 0x000000, 2, 0xFFCC00);
-
-
function crearMarco(x:Number, y:Number, w:Number, h:Number, r:Number, borderColor:Number, borderWidth:Number, fillColor:Number)
-
{
-
this.createEmptyMovieClip("marco_mc", 1);
-
-
marco_mc._x = x;
-
marco_mc._y = y;
-
-
with (marco_mc)
-
{
-
lineStyle(borderWidth, borderColor, 100);
-
beginFill(fillColor);
-
moveTo(r, 0);
-
lineTo(w - r, 0);
-
curveTo(w, 0, w, r);
-
lineTo(w, h - r);
-
curveTo(w, h, w - r, h);
-
lineTo(r, h);
-
curveTo(0, h, 0, h - r);
-
lineTo(0, r);
-
curveTo(0, 0, r, 0);
-
endFill();
-
}
-
}
Es especialmente útil a la hora de hacer máscaras en tiempo de ejecución
También dejo el FLA para descargar.
Descargar función marcos redondeados
2 Comments





