Domanda

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.

È stato utile?

Soluzione

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.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top