Actionscript 3 使用AS3.0轻松平滑

Actionscript 3 使用AS3.0轻松平滑,actionscript-3,flash,actionscript,Actionscript 3,Flash,Actionscript,我想知道,当鼠标悬停在使用AS3.0的对象上时,是否有办法减轻缩放效果。我知道你可以用movieclips来做,但我想用AS3.0来尽可能地压缩我的文件 我现在使用的代码非常简单 import flash.events.MouseEvent; my_mc.addEventListener(MouseEvent.MOUSE_OVER, mouse_over); my_mc.addEventListener(MouseEvent.MOUSE_OUT, mouse_out); function m

我想知道,当鼠标悬停在使用AS3.0的对象上时,是否有办法减轻缩放效果。我知道你可以用movieclips来做,但我想用AS3.0来尽可能地压缩我的文件

我现在使用的代码非常简单

import flash.events.MouseEvent;

my_mc.addEventListener(MouseEvent.MOUSE_OVER, mouse_over);
my_mc.addEventListener(MouseEvent.MOUSE_OUT, mouse_out);

function mouse_over(evt:MouseEvent){
    my_mc.width = 200;
    my_mc.height = 200;
}

function mouse_out(evt:MouseEvent){
    my_mc.width = 90;
    my_mc.height = 90;
}

使用吐温。我建议你看看。您的代码如下所示:

function mouse_over(evt:MouseEvent){
    TweenLite.to(my_mc, {width:200, height:200, ease:Cubic.easeInOut});
}

function mouse_out(evt:MouseEvent){
    TweenLite.to(my_mc, {width:90, height:90, ease:Cubic.easeInOut});
}

您可能希望实际指定一些缓解措施,因为这才是问题的真正所在。我不记得tween lite默认值是什么,但它可能是线性的。Quad.easeInOut或Quint.easeInOut可能看起来不错。此外,还可以解释TweenLite不是免费的*。如果您在向最终用户收取费用的应用程序中使用它,则需要对其进行许可。但是,还有很多选择,包括内置的Tween类,它也可以将文件大小保持在较低的水平。TweenLite是最好和最成熟的,尽管至少在我看来是这样