Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multi MovieClips in ScrollPane

Status
Not open for further replies.

ToddWW

Programmer
Mar 25, 2001
1,073
US
I need to place multiple movie clips into a flash scroll pane component.

The problem I am running into is I need to create thes movie clips dynamically using the attachMovie method.

Here is what I have.

Each movie clip is a draggable 300x100 box with various content inside. My Actionscript could serve up as many as 30 of these movie clips, stacked vertically.

I created a single movie clip to act as the frame and made that 320x700. For testing purposes, I placed that on the stage and gave it an instance name of mcLocationsFrame

Then I wrote the following code.
Code:
for (var i:Number = 0; i < xmlArray.length; i++) {
  var mcTempClip:MovieClip = _root.mcLocationsFrame.attachMovie("mcLocationPanel","mcLocation_"+i,i+1);
  mcTempClip._x = 0;
  mcTempClip._y = i*100;
}

This works great. When I export the fla the frame is on the screen and the dynamic movie clip instances are stacked vertically inside the frame until they disappear beyond the frame's boundary.

What I need to do is scroll that movie clip frame so I can bring the rest of the dynamic movie clips into view. Since the Scroll Pane component accepts a linkage identifier to a single movie clip symbol in the library, I removed the frame instance from the stage and placed and sized a scroll pane component on the stage. I set the movie clip frame to export and gave it an identifier and placed that identifier in the parameters for the scroll pane.

Now, when I export the fla, I see the movie clip inside the scroll pane (I see the borders), so I know the linkage is correct, but now my attachMovie methods are not working any more. I tried to fiddle with the target in my attachMovie statement to include the instance name of the scroll pane, but I can't figure this out.

Any ideas on how to scroll multiple, dynamically created, movie clips inside a scroll pane component? Preferrably without having to load a seperate swf into the scroll pane component.

Thanks for all your help.

ToddWW
 
Figured it out. To get reference to the movieclip inside the scroll pane component you can use the content property of the scroll pane component. It provides a reference to whatever is in the scroll pane.

I was able to use that to dynamically attach multiple movie clips inside the scroll pane.

Now I'm having a problem with scaling the movie clip inside the scroll pane. In order for the scroll pane to work properly, I need to resize the movie clip dynamically to compensate for the # of individual movie clips I am attaching. Even though I perform the resize BEFORE I attach the movie clips, the attached movie clips scale also.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top