5 Replies Latest reply on May 29, 2007 8:34 AM by michaelfb

    Simple (?) paths problem

      I have an image gallery consisting of thumbnail buttons, which load the external fade in/out files. When the buttons are on the main timeline everything works perfectly, but I wanted them to be scrollable so I placed them in a MC(main) and now the externals won’t load – the scrolling and button actions are fine.
      There are 2 separate container movie clips for the content to load into and there’s also a preloader.
      Here’s the buttonAS:

      var bottomcontainer = container1_mc;

      // load image 1 loads the image using startPreload
      image1_btn.onPress = function(){
      function startPreload(url){
      attachMovie("preloader anim", "preloader_mc", 500, {_x:740, _y:454});
      bottomcontainer._alpha = 0;
      bottomcontainer.onEnterFrame = preloadContents;


      I built the site in small chunks and didn’t expect to encounter further problems during final assembly; I’m now completely baffled! Any suggestions as to what’s wrong?

        • 1. Re: Simple (?) paths problem
          kglad Adobe Community Professional & MVP
          is container1_mc on the _root timeline or the timeline of main (or somewhere else)?
          • 2. Re: Simple (?) paths problem
            Level 1

            Everything’s on the main timeline and worked perfectly until I added the scroller. All the thumb buttons are now housed within a MC named main.
            • 3. Re: Simple (?) paths problem
              kglad Adobe Community Professional & MVP

              • 4. Re: Simple (?) paths problem
                Level 1
                Unfortunately, no joy. I tried preloadcontents with and without _parent.

                To clarify: the container has a separate script, but I didn’t think this would be causing the problem:

                // this is the event handler for each container's
                // onPreloaderComplete event - a custom event invoked
                // in the preloadContents function
                function preloadComplete(){

                // swap the depths of the containers putting the
                // one who just got new content at the top

                // check the depths of the 2 containers and assign
                // bottomcontainer to the new lowest container
                if (container1_mc.getDepth() < container2_mc.getDepth()){
                bottomcontainer = container1_mc;
                bottomcontainer = container2_mc;

                // remove the preloader animation

                // set the onEnterFrame event to fade in this container
                this.onEnterFrame = fadeIn;

                // this function fades in a container
                // once its content has loaded
                // it is to be used with onEnterFrame
                function fadeIn(){

                // if the alpha is less than 100, fade in
                if (this._alpha < 100){

                // increase using a rate of 5
                this._alpha += 5;

                // delete the onEnterFrame event handler
                // running this fadeIn method
                delete this.onEnterFrame;

                // set onPreloaderComplete functions (event handlers)
                // for each container to the preloadComplete function
                // when a container is completely loaded, preloadContents
                // will call onPreloaderComplete for the container which
                // will run preloadComplete because of these definitions
                container1_mc.onPreloaderComplete = preloadComplete;
                container2_mc.onPreloaderComplete = preloadComplete;
                • 5. Re: Simple (?) paths problem
                  Level 1
                  This is the commented button AS:

                  // define a variable used to keep track of what
                  // container is the bottom container
                  var bottomcontainer = main.container1_mc;

                  // load image 1 loads the beach image using startPreload
                  image1_btn.onPress = function(){

                  // this function begins preloading an image url in
                  // the bottom-most container as specified by bottomcontainer
                  function startPreload(url){

                  // attach the preloader animation
                  // this will be removed when preloading is complete
                  attachMovie("preloader anim", "preloader_mc", 500, {_x:740, _y:454});

                  // set the alpha to 0 - it will be faded back
                  // in over the other container once loaded
                  bottomcontainer._alpha = 0;

                  // use loadMovie to load the image url into the
                  // contents_mc of the container - not the container
                  // itself because loadMovie will delete all variables
                  // and functions (like onEnterFrame) if called on
                  // the container directly

                  // set the onEnterFrame event to call preloadContents
                  bottomcontainer.onEnterFrame = preloadContents;