PDA

View Full Version : MovieClips and ScrollPanes


mybrainhurts
10-21-2005, 10:57 AM
Hello there! If anyone can answer this, I will be forever indebted. :D

I want to return information from a database (image URLs etc) and then create a varying number of movieclips from this. I then want to attach these movieclips to a single movieclip (acting as a container). All works fine until the point that I try to put all this into a scrollpane component. The movieclip (and subclips) are not displayed in the scrollpane and I get an error message. :( :(

Here is some example code:

createEmptyMovieClip("mc", 0);
mc.attachMovie("Circle", "myCircle", 1);
//sp.contentPath = "mc"; //Method 1 - Doesn't work
sp.contentPath = "Circle"; //Method 2 - This works because it is aleady is in the library

I created a movie clip symbol in the library called "Circle" (a big red circle) and given it a linkage name "Circle" also. I then placed a scrollPane on the stage and given it an instance name of "sp".

Can anyone please tell me how I can create a movieclip, attach another movieclip and then put it all into a scrollpane? :confused:

PS
The error message I get trying to use Method 1 is:

Error opening URL "file:///C|/Documents%20and%20Settings/Roger/My%20Documents/My%20Flash/mc"

Navarone
10-21-2005, 12:15 PM
Have you tried

this.createEmptyMovieClip("mc", this.getNextHighestDepth())

mybrainhurts
10-21-2005, 12:22 PM
Hi there,

Thank you so much for your advice, I was losing hope that anyone would care about my dilemma! :)

Unfortunately your suggestion doesnt help in this case. I still get the error message:

Error opening URL "file:///C|/Documents%20and%20Settings/Roger/My%20Documents/My%20Flash/_level0.mc"

Any other ideas?

:confused: :confused: :confused:

Navarone
10-21-2005, 12:29 PM
The error message means flash is looking for something and can't find it. You may want to check your path's; make sure your flash file is in the same directory, etc....

sleekdigital
10-21-2005, 02:21 PM
You don't put stuff from the stage into a scrollpane. It has to come from either the lbrary or load an external file. What I do is set the contentPath to the linkage id of an empty MC in my library. Then I use scrollpane.content.attachMovie to get stuff inside the scrollpane.

Example...
http://www.sleekdigital.com/downloads/scrolllistexample.zip

mybrainhurts
10-21-2005, 02:26 PM
Thank you everybody for your help, especially sleekdigital, who in my eyes is now a god! :cool:

Seriously, I've spent days trying to overcome this problem!

I dont have time to test this solution right now, but I am very positive from looking at it that it will work.

Woohoo!

Thanks again! :D :D :D

sleekdigital
10-21-2005, 02:40 PM
I'm no god :) but it does indeed work. I've answered this question many times here and on the components board. Its a pretty common problem which is why I wrote the class you see in the example code. You have to know what your doing with AS 2.0 classes to use it, but that's good to know anyway.