2 Replies Latest reply on Jan 21, 2010 3:36 PM by kglad

    Make pictures fade-in to eachother using UIloader

    varget123

      I have a problem making pictures fade into each other.

       

      I have a gallery using UIloader. the problem is that when I press the next_btn the prev pic dissapears during the upcoming loads.

      I really appreciate help on this one!

      cheers!

      this is my code:

       

      bcn_next_btn.addEventListener(MouseEvent.CLICK, nextImage);

      import fl.transitions.Tween;
      import fl.transitions.easing.*;

      //variable is a container that holds som value.....

      var imageNumber:Number = 1;



      function checkNumber(): void{
          bcn_next_btn.visible=true;
          bcn_back_btn.visible=true;
          //it the imagenumber is = 5 then do something
          if (imageNumber==3){
              trace(imageNumber);
              bcn_next_btn.visible = false
          }
          // if the imagenumber is = 1 then dont show the backbtn
          if(imageNumber==1){
              trace(imageNumber);
              bcn_back_btn.visible = false;
          }
      }
      checkNumber();



      function nextImage(evtObj:MouseEvent):void
      {
          imageNumber++;
          LargeImageLoader.source = "image/emma/emma_"+imageNumber+".jpg";
          checkNumber();
      }

      bcn_back_btn.addEventListener(MouseEvent.CLICK, backImage);

      function backImage(evtObj:MouseEvent):void
      {
         
          imageNumber--;
          LargeImageLoader.source = "image/emma/emma_"+imageNumber+".jpg";
          checkNumber();
      }


      LargeImageLoader.addEventListener(Event.COMPLETE, ImageLoaded);

      function ImageLoaded(event:Event){
          new Tween(LargeImageLoader,"alpha",Regular.easeOut,0,1,2,true);   

      }


      progressBar.source=LargeImageLoader,
      progressBar.addEventListener(ProgressEvent.PROGRESS,progressHandler);
      progressBar.addEventListener(Event.COMPLETE,completeHandler);

      function progressHandler (event:ProgressEvent):void{
         
         
         
      }

      function completeHandler (event:Event):void{

             
      }