1

Can anyone give advice on what would be a proper way to set a MovieClip as the source of a ScrollPane in ActionScript3?

I wish to have a MovieClip (Lets call it "A") that holds ten smaller movieclips (lets call them "b"). Then, I would like to add "A" to the ScrollPane and have the other ten "b" movie clips also show up.

Some pseudo code I am trying goes like this:

scroll_area = new ScrollPane();

A = new A(); //MovieClip that will contain the smaller MovieClips

scroll_area.source = A;

for (i= 0; i < 10; i++)
{
    _b = b(); // smaller movie clip
    _b.y = y + 20; // for spacing
    y = y + 20;

    A.addChild(_b);
}

scroll_area.update();

This however ends up with the ScrollArea just being present and nothing else.

Any advice is much appreciated.

mherr
  • 348
  • 1
  • 7
  • 25

1 Answers1

1

Are you sure, that you did everything right?

  1. Export component to the library
  2. Instantiate ScrollPane
  3. Set size for scroll area, and add it to the display list
  4. Create content that will be scrolled
  5. Set source with reference on newly created content.
Nicolas Siver
  • 2,875
  • 3
  • 16
  • 25
  • Thanks for your comment. I would say that I am doing those things. The MovieClips are in the library, as well as the ScrollPane and UIScrollBar. My actionscript seems to be doing the rest of the steps you've mentioned. My codesnippet does not show the sizing of the scroll area, but my actual code does. – mherr Mar 21 '14 at 18:08
  • So, I would recommend test your `A` movieclip. Add him to the Display list, and check, that all is ok. `addChild(A);` – Nicolas Siver Mar 21 '14 at 18:10
  • Thanks very much! There did seem to be a problem with my "A" MovieClip. I've got something working now, You drew my attention to the problem and I appreciate your help! – mherr Mar 21 '14 at 19:21