5 Replies Latest reply on Jul 30, 2010 6:19 AM by kglad

    how to put a preloader showing loading percent to this flash gallery?

    ankur rander

      hi i am loading all thumbs and  images in a container on a single frame using action script..but the  size of the swf becomes 1.2 mb so i want to add a loader to it...the  loader i am trying to add counts the frames but my file has just one  frame so the loader doesnot show up..

       

      here is the script of my  gallery..and the timeline has just one frame...

       

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

       

      this.createEmptyMovieClip("container",1);
      var  imagesNumber:Number = 18;
      var scrolling:Boolean = true;

       

      for (i=1;  i<=imagesNumber; i++) {
      container.attachMovie("thumb"+i,"thumb"+i+"_mc",i);
      myThumb_mc  = container["thumb"+i+"_mc"];
      if (i==1)
      {
          myThumb_mc._x =  (0.0)*myThumb_mc._width;

       

      }
      else
      {
          myThumb_mc._x =  ((1.2*i)-1.2)*myThumb_mc._width;
      }

       

      myThumb_mc._y =  (Stage.height-myThumb_mc._height)/2;
      myThumb_mc._alpha = 100;
      myThumb_mc.largerImage  = i;
      myThumb_mc.onRollOver = function() {
      this._alpha = 60;
      };
      myThumb_mc.onRollOut  = function() {
      this._alpha = 100;
      };
      myThumb_mc.onRelease =  function() {
      this._alpha=100;
      for (i=1; i<=imagesNumber; i++) {
      var  myClip = container["thumb"+i+"_mc"];
      myClip.enabled = false;
      }
      scrolling  = false;
      _root.attachMovie("image"+this.largerImage,"large_mc",2);
      large_mc._x  = (Stage.width-large_mc._width)/2;
      large_mc._y =  (Stage.height-large_mc._height)/2;
      new Tween(large_mc, "_alpha",  Strong.easeOut, 0, 100, 0.5, true);
      new  Tween(container,"_alpha",Strong.easeOut,100,50,0.5,true);
      large_mc.onRelease  = function() {
      scrolling = true;
      var myFadeOut = new  Tween(large_mc, "_alpha", Strong.easeOut, 100, 0, 0.5, true);
      new  Tween(container,"_alpha",Strong.easeOut,50,100,0.5,true);
      myFadeOut.onMotionFinished  = function() {
      for (i=1; i<=imagesNumber; i++) {
      var myClip =  container["thumb"+i+"_mc"];
      myClip.enabled = true;
      }
      large_mc.removeMovieClip();
      };
      };
      };
      }

       

      container.onEnterFrame  = function() {
      if (scrolling){
      this._x +=  Math.cos((-_root._xmouse/Stage.width)*Math.PI)*20;
      if (this._x>0) {
      this._x  = 0;
      }
      if (-this._x>(this._width-Stage.width)) {
      this._x =  -(this._width-Stage.width);
      }
      }
      };

       

       

       

      anyone knows how to add a loadre to this...?

       

      thanks..