8 Replies Latest reply on Apr 17, 2006 11:05 AM by Peter Lorent

    Problems with Classes

    martha_stewart
      Hi everyone.

      I am using a scroller class from kirupa, however i am having a small problem. Everything works fine if i place it all on the main time line. however when i want to package all the mc's used for the scroller into a mc of it own the scroller will not update for the new content. I am losing some hair trying to tackle this one on my own and would love it if someone could help.

      Here are the files:

      EDITED: i have just added both the version of the scroller in a container...and one that is not. The one that is not work perfectly, the one that is in the container has the flaw that when the new content is loaded in the scroll bar does not hide or change height, it keeps the property of the initial mc loaded.

      Hope that makes sense.

      Zipped Files

      Thanks for all for taking time for this.

      Very much appreciated,

      Martha Stewart
        • 1. Re: Problems with Classes
          Peter Lorent Level 2
          You forgot something on the buttons - example 'Care' - see attached code.

          • 2. Problems with Classes
            martha_stewart Level 1
            Hi LuigiL,

            Thanks for replying i really appreciate it. The change to the button code however doesn't actually change anything. The new mc that is loaded should then trigger the scrollbar to see whether it should be visible and if it is then change the height for the scroller. So right now the initial mc loaded is "aboutxt". If i load "historytxt" by pressing the button the scrollbar still is visable even though it is not needed as well as it scrolls the entire height of the "abouttxt". I hope this all makes sense, and i would forever in your debt if you could or anyone else help me out on this problem.

            Thanks so much,

            Martha Stewart
            • 3. Re: Problems with Classes
              Peter Lorent Level 2
              See what you mean. Well, apart from what I posted, the path to the 'myscrollbar' is also wrong. Should be:
              setTimeout(Scroller.myscrollbar, "setScrollProps", 50);
              But, that doesn't solve the problem completely. Somehow the call to setScrollProps doesn't return proper values.
              The only way I can correct this, is by putting the buttons in the Scroller mc and use the attached code on the buttons. If I have some time left, I'll look into it again.


              • 4. Re: Problems with Classes
                martha_stewart Level 1
                Hi LuigiL,

                Thanks for all your help and time, i will try to see what i can figure out also and keep you informed. I really appreciete you taking the time for this.

                Sincerely,

                Martha Stewart
                • 5. Re: Problems with Classes
                  Peter Lorent Level 2
                  Think it works (almost) properly now. This is the code for the buttons (change the mc to attach...)
                  on(release){
                  Scroller.contentMain.unloadMovie;
                  Scroller.contentMain.attachMovie("historytxt","newcontent",1) ;
                  // Line of importance
                  setTimeout(Scroller.myscrollbar, "setScrollProps", 50);
                  Scroller.myscrollbar.backToTop();
                  }

                  Make one correction in the class:
                  public function backToTop():Void
                  {
                  dragger._y = top;
                  content._y = 0; // instead of 'top'
                  updateContentPos();
                  }
                  Now that last correction disables the easing effect when clicking on a new topic, but there's something wrong in the class and the 'new' values are not correct. I'll try to figure it out.
                  • 6. Re: Problems with Classes
                    Peter Lorent Level 2
                    To pinpoint the problem:
                    backToTop() calls updateContentPos() which provides a new content._y value (content.newY) for the content.onEnterFrame.
                    If you put a trace in the else-leg:
                    {
                    this._y += (this.newY-this._y)/this.speed;
                    trace(this._y);
                    }
                    you'll see it doesn't return to 0 like it should but traces 18, 20 and values in between.
                    • 7. Re: Problems with Classes
                      martha_stewart Level 1
                      Greetings LuigiL,

                      Well everything looks and runs the way i need it to so i must say THANKYOU!

                      I am still unsure what you meant by your last comment, but i won't try to fix what i hope is not broken. Thanks for all your valuable help and input. I really appreciate people like yourself who are around to help those of us with a bit less then a good grasp on actionscript! Keep up the great work, your presence here does not go unnoticed!

                      I will post the final project here just incase you want to see what your hard work went towards.

                      Sincerely,

                      Martha Stewart
                      • 8. Re: Problems with Classes
                        Peter Lorent Level 2
                        You're welcome. Of course a part of the contributions here is trying to help others. But, to be honest, it's also a great source to learn from solving other peoples questions.

                        To elaborate on my last post:
                        After startup when you click 'history' or any other topic, the scroller returns to 0. Now click another topic and the scroller will return to 18. And when you click a third topic, the scroller returns a value of 20. That is, in the uncorrected version. The problem now is to find where those values 18 and 20 are coming from. Didn't find it yet but eventually I will find the problem.