PDA

View Full Version : Yet more trouble with scrollpane


jimmy
04-17-2006, 05:36 PM
Okay, I'd like to preface this by saying I have looked for sometime for this solution but have not had any luck.

I want to dynamically attach movieclips to a scrollpane. This is no problem, but wait there is more. I am using the following method to do this: I have an empty movieclip in my library that I have exported for ActionScript and has a Linkage ID. I set the contentpath of the scrollpane to the Linkage ID. I then attach movieclips to the scrollpanes "content". The movieclips I am attaching contain components on them (textinput, textarea, and combobox). What I am doing is allowing the user to add as many movieclips as he wants and he can change the content of those movieclips. The user can also create a new page with the same scrollpane on it and same idea of attaching movieclips and being able to change content. Navigating through the pages all of the users changes are saved in an array (page at a time so one index represents one page of data). All of the data is being stored and updated in the array correctly. When I go to repopulate the page I have weird problems.

So repopulating I first save what is on the current page into the array into the correct index for that page. No problem. Then I clear the page removing all the movieclips from the page using the removeMovieClip function but first swapping the depth to 1048000 so it is always in the range of being able to be removed at runtime. Then I repopulate by adding the movieclips back to the scrollpane content. Once the movieclips are there I then call a populate movieclip function that takes the stored data from the array for that page and populates the data for those movieclips. This works too!

Ok ok, don't worry I am getting to the part that doesn't work. :D

The problem happens when I add movieclips to the scrollpane, then add a new page, then go back to the previous page. My components show up blank!! (no data). Remember the data in the array is correct, and strangely enough when I click on the combobox I see the dropdown list and the correct one is actually selected! It just shows up as a blank when the dropdown list is up. Other components are blank as well.

Okay, now a little weirder. If I add movieclips to page 1, then add a page and add a page again (skip page 2 basically) it works fine. No blank components. This lead me to believe that the scollpane needed more time to initialize the properties of the components so I am using the doLater method which you supply it with a function name (i am using the populate movieclip function) and it calls the function when the scrollpane is supposedly finished. This gives no change in results. So now I am thinking it is a possible depth problem but I do not see where this could be since I am iterating the depth.

This process works fine if my movieclips replace the textinput and textarea component with input textfields. That is a fine solution for that, but I really need to use the combobox component (which still has this problem).

I guess the main question is has anyone seen anything like this with components and scrollpanes? Does anyone have any ideas as to what could be happening and/or possible solutions. I am very much interested and would like to understand this issue better.

Thanks guys!