5 Replies Latest reply on Jun 28, 2013 6:11 AM by kglad

    want to close a function and load new function...by button....

    Emraan.Khan

      my button code is ..

       

      on(release) {

       

      this.wall.removeMovieClip(callThumbs());

       

      loadnextF();

      }

       

      and my all scripts is ............

       

      import mx.transitions.Tween;

      import mx.transitions.Zoom.*;

      import caurina.transitions.*;

       

       

       

       

      var myGalleryXML = new XML();

      myGalleryXML.ignoreWhite = true;

      myGalleryXML.load("26-demo.xml");

      myGalleryXML.onLoad = function()

      {

          _root.gallery_x = myGalleryXML.firstChild.attributes.gallery_x = 100;

          _root.gallery_y = myGalleryXML.firstChild.attributes.gallery_y;

          _root.gallery_width = myGalleryXML.firstChild.attributes.gallery_width;

          _root.gallery_height = myGalleryXML.firstChild.attributes.gallery_height;

       

          _root.myImages = myGalleryXML.firstChild.childNodes;

          _root.myImagesTotal = myImages.length;

       

          _root.thumb_height = myGalleryXML.firstChild.attributes.thumb_height;

          _root.thumb_width = myGalleryXML.firstChild.attributes.thumb_width;

       

          _root.full_x = myGalleryXML.firstChild.attributes.full_x;

          _root.full_y = myGalleryXML.firstChild.attributes.full_y;

       

          callThumbs();

       

      };

       

      function callThumbs()

      {

       

          _root.createEmptyMovieClip("wall",_root.getNextHighestDepth());

          wall._x = _root.gallery_x = 0;

          wall._y = _root.gallery_y = 230;

       

       

       

          wall.addEventListener(MouseEvent.CLICK);

       

       

       

          var clipLoader = new MovieClipLoader();

          var preloader = new Object();

          clipLoader.addListener(preloader);

       

       

       

          for (i = 0; i < 6; i++)

       

       

          {

              thumbURL = myImages[i].attributes.thumb_url;

       

              myThumb_mc = wall.createEmptyMovieClip(i, wall.getNextHighestDepth());

              myThumb_mc._x = _root.thumb_height * i;

              myThumb_mc._x = _root.thumb_position = -3260 + i * 765;

       

       

              clipLoader.loadClip("shop/" + thumbURL,myThumb_mc);

       

       

       

              preloader.onLoadStart = function(target)

              {

                  target.createTextField("my_txt",target.getNextHighestDepth(),0,0,10,10);

                  target.my_txt.selectable = false;

              };

       

       

              preloader.onLoadProgress = function(target, loadedBytes, totalBytes)

              {

                  target.my_txt.text = Math.floor((loadedBytes / totalBytes) * 100);

              };

       

              preloader.onLoadComplete = function(target)

              {

                  new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);

                  target.my_txt.removeTextField();

                  target.onRelease = function()

                  {

                      callFullImage(this._name);

       

                  };

       

       

       

                  target.onRollOver = function()

                  {

                      this._alpha = 100;

                  };

       

                  target.onRollOut = function()

                  {

                      this._alpha = 100;

                  };

       

              };

       

       

          }

      /*

          for (i = 6; i < 12; i++)

       

          {

              thumbURL = myImages[i].attributes.thumb_url;

       

              myThumb_mc = wall.createEmptyMovieClip(i, wall.getNextHighestDepth());

              myThumb_mc._x = _root.thumb_height * i;

              myThumb_mc._x = _root.thumb_position = -7367 + i * 765;

              myThumb_mc._y = _root.thumb_position = 180;

       

              clipLoader.loadClip("shop/" + thumbURL,myThumb_mc);

       

       

       

              preloader.onLoadStart = function(target)

              {

                  target.createTextField("my_txt",target.getNextHighestDepth(),0,0,10,10);

                  target.my_txt.selectable = false;

              };

       

       

              preloader.onLoadProgress = function(target, loadedBytes, totalBytes)

              {

                  target.my_txt.text = Math.floor((loadedBytes / totalBytes) * 100);

              };

       

              preloader.onLoadComplete = function(target)

              {

                  new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);

                  target.my_txt.removeTextField();

                  target.onRelease = function()

                  {

                      callFullImage(this._name);

                  };

       

       

       

       

                  target.onRollOver = function()

                  {

                      this._alpha = 100;

                  };

       

                  target.onRollOut = function()

                  {

                      this._alpha = 100;

                  };

       

              };

          }

      */

       

      }

      //var gapX:Number=5;

       

      var nextX:Number = 7;

       

      var loadNum:Number=7;

       

      var preloader:Object={};

       

      var clipLoader:MovieClipLoader=new MovieClipLoader();

       

      clipLoader.addListener(preloader);

       

      function loadnextF(){

       

              thumbURL = myImages[loadNum].attributes.thumb_url;

       

              myThumb_mc = wall.createEmptyMovieClip(loadNum, wall.getNextHighestDepth())

       

              myThumb_mc._alpha=0;

       

              clipLoader.loadClip("shop/"+thumbURL,myThumb_mc);

       

              }

      for (j=7; j<9; j++)

       

       

          {

              thumbURL = myImages[j].attributes.thumb_url;

       

              myThumb_mc = wall.createEmptyMovieClip(j.getNextHighestDepth());

              myThumb_mc._x = _root.thumb_height * j;

              myThumb_mc._x = _root.thumb_position = -3260 + j * 765;

       

      /*

              preloader.onLoadStart = function(target) {

       

                  target.createTextField("my_txt",target.getNextHighestDepth(),0,0,10,10);

       

                  target.my_txt.selectable = false;

       

              };

       

       

       

       

       

              preloader.onLoadProgress = function(target, loadedBytes, totalBytes) {

       

                  target.my_txt.text = Math.floor((loadedBytes/totalBytes)*100);

       

              };

      */

          }

       

              preloader.onLoadComplete = function(target) {

       

      target._x = nextX;

       

      nextX += target._width+gapX;

       

      loadNum++;

       

      if(loadNum>7){

       

      loadnextF();

       

      }

                  new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);

       

                  target.my_txt.removeTextField();

       

                  target.onRelease = function() {

       

                      callFullImage(this._name);

       

       

       

                  };

       

       

       

       

       

       

       

                  target.onRollOver = function() {

       

                      this._alpha = 100;

       

                  };

       

       

       

                  target.onRollOut = function() {

       

                      this._alpha = 100;

       

                  };

       

       

       

              };

       

      function callFullImage(myNumber)

      {

       

          myURL = myImages[myNumber].attributes.full_url;

          myTitle = myImages[myNumber].attributes.title;

          _root.createEmptyMovieClip("ajit",_root.getNextHighestDepth());

          ajit._x = _root.full_x = 130;

          ajit._y = _root.full_y = 32;

       

          /*by forum*/

          _root.onEnterFrame = function()

          {

              wall._alpha = 0;

              if (_root._currentframe == 2)

              {

                  wall._alpha = 100;

              }

       

          };

       

       

          this.gotoAndStop(21);

       

          var fullClipLoader = new MovieClipLoader("ajit");

          var fullPreloader = new Object();

          fullClipLoader.addListener(fullPreloader);

       

       

          fullPreloader.onLoadStart = function(target)

          {

              target.createTextField("my_txt",ajit.getNextHighestDepth(),0,0,400,20);

              target.my_txt.selectable = false;

          };

       

          fullPreloader.onLoadProgress = function(target, loadedBytes, totalBytes)

          {

              target.my_txt.text = Math.floor((loadedBytes / totalBytes) * 100);

          };

       

          fullPreloader.onLoadComplete = function(target)

          {

              new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);

              target.my_txt.text = myTitle;

          };

       

          fullClipLoader.loadClip("full_images/" + myURL,ajit);

       

      }