3 Replies Latest reply on Sep 13, 2011 11:16 AM by gatto26

    Scrollbar malfunction, dynamic loading text/img content

    gatto26

      I have some content loaded into a dynamic text field. The content is in an HTML text file. When the content loads with text only, everything works fine, but when I put in a link to an image file, the scroll bar does not function properly and goes below the height of the text field. Thanks for looking!

       

      Here is a link to what I am working on to show how it is not working:

      http://www.luxelab.com/beta/press.html

       

      and the AS:

      //eventhandler for the onEnterFrame from the scrollmovie

      this._lockroot = true;

       

      function FNSCROLL(){

      if(this.scrollText != undefined ){

      if(this.scrollText.maxscroll==1){

      if(this._visible) this._visible=false;

      }

      else{

      if(!this._visible)this._visible=true;

      }

      this.slyder.clear();

      this.slyder.lineStyle(1,0xFFFFFF,100);

      this.slyder.moveTo(0,0);

      this.slyder.lineTo(0,this.scrollText._height-1);

      this.rectwrapper._y=this.scrollText._height-this.rectwrapper._height;

      if(this.pressUp){

      if(this.scrollText.scroll>0){

      this.scrollText.scroll-=1;

      this.dragger._y = 10+int( (this.scrollText._height-30)*(this.scrollText.scroll-1) / this.scrollText.maxscroll );

      }

      }

      if(this.pressDown){

      if(this.scrollText.scroll<this.scrollText.maxscroll){

      this.scrollText.scroll+=1;

      this.dragger._y = 10+int( (this.scrollText._height-30)*(this.scrollText.scroll-1) / this.scrollText.maxscroll );

      }

      }

      if(this.dragging){

      var loc = this.dragger._y;

      var yDragged = loc-10;

      var newScroll = this.scrollText.maxscroll*yDragged/(this.scrollText._height-30);

      this.scrollText.scroll=1+int(newScroll);

      }

       

      }

      }

       

      and the text file:

      &article= <img src="admin/images/pressexample.jpg"/>

       

      PRESS TEXT

      Luxelab, nestled among the boutiques and cafes of Santa Monica's posh Montana Avenue, is the beautiful brainchild of Jason Lara and David Abrams. With their more than 40 years combined experience in the salon industry, Lara and Abrams put their well groomed heads together and created the perfect environment for their chic clientele. Luxelab is dedicated to the modern client. It is sleek, progressive, and sets the pace for Los Angeles hairdressing.

       

      <img src="admin/images/pressexample.jpg"/>

       

       

       

       

      PRESS TEXT

      Luxelab, nestled among the boutiques and cafes of Santa Monica's posh Montana Avenue, is the beautiful brainchild of Jason Lara and David Abrams. With their more than 40 years combined experience in the salon industry, Lara and Abrams put their well groomed heads together and created the perfect environment for their chic clientele. Luxelab is dedicated to the modern client. It is sleek, progressive, and sets the pace for Los Angeles hairdressing.

        • 1. Re: Scrollbar malfunction, dynamic loading text/img content
          kglad Adobe Community Professional & MVP

          you need to wait until loading (of your image) is complete before assigning scrollbar parameters.

          • 2. Re: Scrollbar malfunction, dynamic loading text/img content
            gatto26 Level 1

            Not sure if this is what you meant, but I tried adding some frames to the layer where the text field is located, about 10, and then a keyframe containing the scrollbar with the parameters. Unfortunately, that did not do the trick, but please let me know if there is some other way this should be done.

            • 3. Re: Scrollbar malfunction, dynamic loading text/img content
              gatto26 Level 1

              I figured this one out by using a different method. I put the dynamic text field in a layer, then a layer with a mask, and the scroller parameters are based on the mask height. Here's some code just in case someone finds it helpful,

               

              txt.setMask(mask)

              scrollbar.onMouseDown = function() {

              if (this.hitTest(_root._xmouse, _root._ymouse) && txt._height>mask._height) {

              this.startDrag(false, scrollbarBG._x, scrollbarBG._y, scrollbarBG._x, scrollbarBG._height-this._height)

              txt.onEnterFrame = scrollThumbs;

              dragging = true

              }

              };

              scrollbar.onMouseUp = function() {

              stopDrag()

              dragging = false

              delete this.onEnterFrame;

              };

              function scrollThumbs() {

               

              var funkyVar = -this._parent.scrollbar._y*(((this._height-this._parent.scrollbar._height)/(this._parent. scrollbarBG._height-this._parent.scrollbar._height))-1)

              this.Y = (funkyVar-this._y)*.2;

              this._y += this.Y;

              if(Math.abs(funkyVar-this._y)<1 && !dragging){

              delete this.onEnterFrame

              }

               

              }