ActionScript - scrolling images from left to right

I created a flash gallery that loads images from xml file and fades them out. However, I was asked to make them fade out from left to right (i.e. hide some of the image while slowly displaying the entire image). Code below:

_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;
        }
    }

      

+1


source to share


1 answer


You can create a mask with a gradient alpha value and then use motion tweens to move it across the image. With the correct blend mode, this will fade out as you want.



0


source







All Articles