Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 331
  • Last Modified:

ScrollPane scroll bars not showing up after content changed

I'm just trying to create a class that controls a scrollpane to load a series of thumbnails off a website. The way I do it is everytime a thumbnail is added to the scrollpane, I create a new movie clip and position it under previous one. My problem is, after adding this new movieclip to content of scrollpane it doesnt' seem to recognize the size of the content has been changed and refuse to let you use the scrollbar. refreshPane() does not work, in fact when I tried refreshPane it showed me blank. I need someone tell me how I can fix this or show me an example of a scrollpane that loads MULTIPLE picture files into it's content then redraw the scrollbars correctly.

My stage area only has one ScrollPane component that has height of 590 and width of 130, the instance is named scrollThumb. The contentPath property of scrollThumb is pointed to a blank movieclip symbol named symScrollArea at design time.

I think you can only point ScrollPane to symbols and once you set the contentpath property to a symbol it creates a new instance of it. It might work if I add clips a movieClip then reset the contentpath property ... but that's for another day. Right now I want an answer to this asap :)

class Thumbnails {
      var scrollArea:MovieClip;
      var thumbsMC:Array = new Array();
      var thumbNotes:Array = new Array();
      var count:Number;
      
      function Thumbnails() {
            this.scrollArea = _root.scrollThumbs.content;
            this.count = 0;
      }

      function addThumb(thumbURL:String) {
            this.count += 1;
            this.thumbNotes[this.count] = this.scrollArea.createEmptyMovieClip("mcThumb" + this.count.toString(), 4500 + this.count);
            with (this.thumbNotes[this.count])
            {
                  loadMovie(thumbURL);
                  _x = 0;
                  _y = (this.count - 1) * 120;
            }
            //_root.scrollThumbs.refreshPane();
            _root.scrollThumbs.setSize(150, 590, false);
            
      }
      
}
0
gotdough
Asked:
gotdough
  • 6
  • 4
1 Solution
 
negatyveCommented:
Try:

_root.scrollThumbs.redraw(true);

after thumbnail resizing..
0
 
gotdoughAuthor Commented:
No luck with that. Can you manipulate a library symbol instance during run time? Or you have to have a moveclip on the stage.
0
 
SavongCommented:
I had some trouble with this a while back and found this solution after some digging around:

_root.scrollThumbs.setSize(_root.scrollThumbs.width, _root.scrollThumbs.height, false);

It seems to work very nicely, just be sure to have those as just .width and .height instead of ._width and ._height or it'll just set the scrollpane size.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
gotdoughAuthor Commented:
Hmm nothing seemed to happen when I do that, still no scroll bar. I know it would redraw scroll bars if I do setSize() after explicitly set the size of the content movieclip (that is stretch the entire movie clip by setting _height and _width).
0
 
SavongCommented:
Interesting, in the component property pane, what is the vScrollPolicy set to?  Doing that command once after I've added all my content to a scrollpane has worked quite nicely for me in the past.  Did you remove the setsize you have in there already?
0
 
gotdoughAuthor Commented:
vScrollPolicy is set to on, I changed it to auto and it didn't seem to affect anything. If you have a sample code that can add infinit graphic clips to a scrollpane, that would be as good as an answer. I'd like to see that and find the problem in my code.
0
 
SavongCommented:
nextX = 5;
nextY = 5;
offsetX = 50;
offsetY = 50;
firstX = nextX;

function buildItems():Void{
            for (var i = 0; i < myXML.childNodes[0].childNodes.length; i++){
                  tempMC = _root.scrollArea.content.attachmovie("attachMC", "attach"+i, 400+i, {_x:nextX, _y:nextY});
                  assetArr.push(tempMC);
                  nextX += offsetX;
                  if(nextX > 750){
                        nextX = firstX;
                        nextY += offsetY;
                  }
            }
            _root.scrollArea.setSize(_root.scrollArea.width,_root.scrollArea.height,false);
      }

I had to modify some code in order for it to make sense in this context, but it works for me.  Of course I'm not seeing why it shouldn't work for you in your code.  Hope that helps some.
0
 
gotdoughAuthor Commented:
Just spent an hour trying stuff. That's very close to what I want. Except that code is only able to attach library movieclips. I want to be able to use loadMovie for dynamic content. If your code used to load dynamic content (from file or URL) can you please give a little more hint?
0
 
SavongCommented:
What I've done is placed an empty clip inside the one loaded from the library, then you can do tempMC.loadMC.loadMovie("URL here");
0
 
gotdoughAuthor Commented:
Okay I made a mistake. Attach movie is supposed to use the linkage name not the name of the instance.
0
 
gotdoughAuthor Commented:
Just to make it clear to anyone who read this thread and looking for solutions
1. You need to create a symbol and set the link identifier, the symbol cannot be empty
2. Use attachMovie to attach this symbol to the content property of your scrollpane
3. Call loadMovie or whatever on the returned handler to dynamicly change the content
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now