1 Reply Latest reply on Jun 12, 2013 4:27 AM by Ned Murphy

    Function do work in only one frame


      this function showing in all frame on stage....i want to it within a perticular frame



      function callThumbs() {


          sliderBox._x = _root.gallery_x=30;

          sliderBox._y = _root.gallery_y=30;




          var clipLoader = new MovieClipLoader();

          var preloader = new Object();



          for (i=0; i<myImagesTotal; i++) {

              thumbURL = myImages[i].attributes.thumb_url;

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

              myThumb_mc._x = _root.thumb_height*i;



              preloader.onLoadStart = function(target) {


                  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.onRelease = function() {




                  target.onRollOver = function() {

                      this._alpha = 100;



                  target.onRollOut = function() {

                      this._alpha = 100;







        • 1. Re: Function do work in only one frame
          Ned Murphy Adobe Community Professional & MVP

          In what way do you mean the function is in all frames?  If you write the function on a layer of its own and only provide one frame for it, it will only exist in that one frame.


          If you mean that what the function creates lives throughout the timeline, then that is because you are creating content dynamically without securing it to an object that has a home in the timeline.  Dynamically created content does not have a home in  the timeline unless you make it a opart of something that has been manually affixed to the timeline, like a movieclip.


          So what you might try is to manually add an empty movieclip in the frame where this code is (on a separate layer) and assign it an instance name, let's say you name it "container".  Then you can change the following line from...








          and that should end up retsricting the dynamically created movieclip to the frame where the container is.  If there is any other content being added to the _root, that too should be retargeted to the container.