Pages Menu
TwitterRssFacebook
Categories Menu

Posted by on 7th May, 2003

ScrollPane component eats movieClip

I was using the scrollpane component in a project and found this bug/tweak.

I have several button and only one scrollpane component. Clicking on the buttons, loads different movie clips into the scroll pane with setScrollContent();. Sofar, so good.

The problem is when you realize that these clips are dynamically created with duplicateMovieClip() when the swf loads. So all clips exist when they are loaded into the scrollpane, but when a clip is replaced by another using setScrollContent(), this happens (line 75) of the ScrollPane component:

FScrollPaneClass.prototype.setScrollContent = function(target){
    this.offset.x = 0;
    this.offset.y = 0;

    // remove or hide the old movie clip
    if ( this.content_mc != undefined ) {
    if (target!=this.content_mc) {
        this.content_mc._visible = false;
   

        this.content_mc.removeMovieClip();
        this.content_mc.unloadMovie();

    }
}
……

Notice the last two lines? This will get rid of any dynamically created movieClip and that is the reason why I was able to load a clip into the scrollPane only once. Once replaced by other content it would delete the old clip. This will only happen to clips created with duplicateMovieClip();

This may have been written there for other reasons, but for what I am using the scrollpane for, I commented out these lines and the component now behaves the way I need it to.

I hope this tip may help someone who has had the same problem and was stuck with a "movieClip eating component" and where .refreshPane() calls were not the solution.

If you know anything I do not know about the scrollPane or have more insight about this particular issue, please let me know.