4 Replies Latest reply on Jun 26, 2013 5:45 AM by Emraan.Khan

    i want to call a function on mouse click...

    Emraan.Khan Level 1

                                             my button script is .....

       

      on (release)  {

      _root.newThumbs();

       

      }

       

       

       

                                                and full scripts is...........

       

       

      import mx.transitions.Tween;

      import mx.transitions.Zoom.*;

      import caurina.transitions.*;

       

      var myGalleryXML = new XML();

      myGalleryXML.ignoreWhite = true;

       

       

      myGalleryXML.load("gallery24.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);

                 /*myImagesTotal*/

      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("banner/"+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;

                  };

       

              };

          }

       

       

      }

       

       

      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;

       

       

          _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);

       

          }

       

       

       

      function newthumb() {                       //wand to call this function on mouse release

       

          _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);

                 /*myImagesTotal*/

      for (i=12; i<13; 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("banner/"+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;

                  };

       

              };

          }

       

       

      }