我制作了一个flash库,可以从xml文件加载图像并将其淡入淡出。然而,我被要求制作它,使它们从左向右淡入(即隐藏一些图像,同时慢慢显示整个图像)。代码如下:
_root.onEnterFrame=function () {
var picLoaded = thisLoader.getBytesLoaded(), picBytes = thisLoader.getBytesTotal();
if (isNaN(picBytes) || picBytes < 4)
return;
updateLoader( (picLoaded/picBytes)*100 );
if ( picLoaded / picBytes >= 1 ) {
endLoader();
setButtonOn( eval("_level0.NavContainer.btnContainer.btn_"+(currentPicture)+".lbl_"+(currentPicture)) );
centerMovie( thisLoader );
swapPlace();
alphaTween = new mx.transitions.Tween(thisLoader, "_alpha", mx.transitions.easing.Regular.easeIn,0,100,2,true);
timerInterval = setInterval( imageGen, hold*1000 );
updateDescription();
lastPicture = ( currentPicture > 1 ? currentPicture - 1 : 1 );
currentPicture = ( currentPicture == maxPicture ? 1 : currentPicture + 1 );
if( maxPicture>1 ){
eval("_container.movie"+( showing == 2 ? 1 : 2 ))._alpha = 0;
}
btn_previous.enabled = true;
btn_next.enabled = true;
delete this.onEnterFrame;
}
}
答案 0 :(得分:0)
您可以使用渐变Alpha值创建蒙版,然后使用补间动画在图像上移动它。使用正确的混合模式,这将使其以您想要的方式淡入。