1 Reply Latest reply on Jun 23, 2009 3:32 PM by Bit Crusher

    TransitionManager via Array on Array image MC help

    Bit Crusher

      Hello -

       

      I have a pretty simple setup that's causing some headaches for me.

       

      Right now I have a manual slide show that works using a simple fade in.  Images via an external directory, set up in an array and dropped into an MC whenever someone clicks "next".

       

      What I need to have happen are different transitions applied to each new image via "next" button click.

       

      I've tried a number of things - setting up a transition array and using "switch" however I seem to be missing the proper code for this.

       

      As it stands, here's the basic functioning code:

       

      ///////////////////////////////// START CODE ////////////////////////////////////////

       


      import mx.transitions.*;
      import mx.transitions.easing.*;

       


      i = 0;
      var imageList:Array = new Array("slides/1.jpg", "slides/2.jpg", "slides/3.jpg", "slides/4.jpg", "slides/5.jpg", "slides/6.jpg", "slides/7.jpg", "slides/8.jpg", "slides/9.jpg", "slides/10.jpg", "slides/11.jpg");

       


      var imageMC:MovieClip = this.createEmptyMovieClip("imageMC"+i, this.getNextHighestDepth());
      loadMovie(imageList[i], ["imageMC"+i]);
      ["imageMC"+i]_alpha = 10;
      fadeRate = 5;
      fade = 10;
      fade_in = true;
      _root.controlsMC.backBtn._visible = false;
      this.onEnterFrame = function() {
          if (fade<100 && fade_in == true) {
              fade += fadeRate;
              ["imageMC"+i]_alpha += fadeRate;

       

          }
      };
      //}

       

      // weak attempt at coding from a non-coder
      /*var image_obj:Object = new Object();
      image_obj.onEnterFrame = function(blinker:MovieClip) {
          switch (transition) {
      case "a" :
      TransitionManager.start(blinker,{type:Iris, direction:Transition.IN, duration:1, easing:Linear, startPoint:6, shape:Iris.SQUARE});
      break;
      case "b" :
      TransitionManager.start(blinker,{type:Squeeze, direction:Transition.IN, duration:1, easing:Linear, startPoint:6});
      break;
      case "c" :
      TransitionManager.start(blinker,{type:Iris, direction:Transition.IN, duration:1, easing:Linear, startPoint:1, shape:Iris.CIRCLE});
      break;
      default :
      ["imageMC"+i]_alpha = 10;
      fade = 10;
      }
      };
      ["imageMC"+i]addListener(blinker);*/

       

       

       

       

       

      _root.controlsMC.nextBtn.onRelease = function() {
          if (i>=0 && i<imageList.length-1) {
              i += 1;
              l += 1;
              unloadMovie(["imageMC"+(i-1)]);
              createEmptyMovieClip(["imageMC"+i],l);
              _parent.number = l;
              loadMovie(imageList[i], ["imageMC"+i]);

       

              ["imageMC"+i]_alpha = 10;
              fade = 10;
              if (i == imageList.length-1) {
                  _root.controlsMC.nextBtn._visible = false;
              }
              if (i>0) {
                  _root.controlsMC.backBtn._visible = true;
              }
              delete this.onEnterFrame;
          }
      };

       

      _root.controlsMC.backBtn.onRelease = function() {
          if (i>=1 && i<=imageList.length-1) {
              i -= 1;
              l -= 1;
              _parent.number = l;
              unloadMovie(["imageMC"+(i+1)]);
              createEmptyMovieClip(["imageMC"+i],l);
              loadMovie(imageList[i], ["imageMC"+i]);
              ["imageMC"+i]_alpha = 10;
              fade = 10;
              if (i<imageList.length-1) {
                  _root.controlsMC.nextBtn._visible = true;
              }
              if (i == 0) {
                  _root.controlsMC.backBtn._visible = false;
              }
              delete this.onEnterFrame;
          }
      };

       

      ////////////////////////////////////////////END CODE//////////////////////////////////////

       

      Any suggestions / guidance would be greatly appreciated!

       

      Thanks

        • 1. Re: TransitionManager via Array on Array image MC help
          Bit Crusher Level 1

          Update:

           

          I added in

          var transArray:Array = new Array(Photo, Squeeze, Zoom, Blinds, PixelDissolve);

           

          function transIn():Void {
              var transType:Transition = transArray[Math.floor(Math.random() * transArray.length)];
              var myTM:TransitionManager = new TransitionManager(this);
              myTM.startTransition({type:transType, direction:Transition.IN, duration:1, dimension:0, easing:Linear, xSections:10, ySections:10, numStrips:10, startPoint:6, shape:Iris.CIRCLE});
          }

           

          then under the next button action:

           

          transIn(imageMC);

           

          which works about 80% of the time.  For some reason not all transitions work (Blinds, PixelDissolve, Iris).  when it hits those in the array there's a pause while it seems like something is happening then the image just appears.

           

          I went through and added in the different params for the transitions, so it's odd as to why it's not running them.

           

          Which I will defer to the panel of experts

           

          Thanks!