Aprovecho de contarte un "bug" que tiene.
Es que si aprietas los botones muy rápidamente (Antes de que termine la transformación)
Luego no funciona bien la transformación.
Ya que Elimino el EnterFrame, una vez que los valores se igualan.
Y por cierto hay otro error.
Que es el if, me falto agregar que también vea si Y es igual.
Así que, no arregle el primer el error. Pero aquí esta el segundo solucionado.
Código :
function CambiarTamaño (X:Number,Y:Number):void
{
mimc.addEventListener(Event.ENTER_FRAME, cambiar);
function cambiar(e:Event):void{
mimc.width+=(X-mimc.width)/5
mimc.height+=(Y-mimc.height)/5
if(X==Math.round(mimc.width)&&Y==Math.round(mimc.height))
{
mimc.removeEventListener(Event.ENTER_FRAME, cambiar);
}
}}
function Accion (e:MouseEvent):void
{
var boton=e.currentTarget.name
if(boton=="btn1"){CambiarTamaño(100,100); }
if(boton=="btn2"){CambiarTamaño(50,50); }
if(boton=="btn3"){CambiarTamaño(150,200); }
}
btn1.addEventListener(MouseEvent.CLICK, Accion);
btn2.addEventListener(MouseEvent.CLICK, Accion);
btn3.addEventListener(MouseEvent.CLICK, Accion);