views:

1492

answers:

4

Hi. I have made a flash gallery that loads images from an xml file and fades them in and out. However I have been asked to make it so they fade in from left to right (i.e. hiding a bit of image while slowly revealing the whole image). Code is 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;
  }
 }
A: 

Sorry - I'm after an explanation about how to fade in the images in from left to right instead of just a standard fade

A: 

You could create a mask with a gradient alpha value and then use a motion tween to move it across the image. With the right blend mode this will cause it to fade in like you want.

John Burton
A: 

Thanks I like the idea but I'm restricted to 'sliding' in the new image. Any tutorials would be great, basically it just needs to load image 1 for say 2 seconds and then image 1 would 'slide' off the page to the right with image 2 coming in from the left. Any help greatly appreciated as I can't find anything meeting these requirements on the web

A: 

Actually John, I had a play around with your suggestion and managed to create the effect I was after. Many thanks for your help