Hello folks, Sorry it's taken such a long time to get back to you - our server was down for a number of days.
Just wanted to say that the DepthManager solution fixed it. Cheers! Matt. ------------------------------------------------
the problem I think is related to
var item = listContainer.createClassObject(symbolName, instanceName, this.getNextHighestDepth(), props);
you shoul let DepthManager manage the Depth
var item = listContainer.createClassChildAtDepth(symbolName, instanceName, DepthManager.kTop, props);
----- Original Message ----- From: "Jeroen Beckers" <[EMAIL PROTECTED]> To: "Flashcoders mailing list" <[email protected]> Sent: Saturday, September 02, 2006 9:38 AM Subject: Re: [Flashcoders] Creating a scrollable list: adding components tothe scrollpane contents
Couldn't you put the list component in a movieclip and add attach the movieclip to the scrollPane (which is a lot easier). Also, what is your 'createUniqueInstanceName()' function ? Matt Bennett wrote:Hello Flashcoders, I'm building a scrollable list, and I keep track of the list items with a Collection. I'm having trouble adding items to it - I think I'm overwriting some instance variables somewhere. In the code below, listContainer is a reference to the contents of a ScrollPane component: var listContainer = scrollPane.content; Here's my function to add a list item: function addListItem(symbolName, props) { // Create the content (instance name: _itemX) var instanceName = this.createUniqueInstanceName(); var item = listContainer.createClassObject(symbolName, instanceName, this.getNextHighestDepth(), props); //add to list items listItems.addItem(item); trace("////////////////////////////////////////////"); trace("debugging addItem"); var iterator = listItems.getIterator(); while(iterator.hasNext()) { var thisitem = iterator.next(); trace("this item: "+thisitem+"; type: "+thisitem.className); } trace("////////////////////////////////////////////"); return item; } After adding 3 items, the debug trace looks like this: //////////////////////////////////////////// debugging addItem this item: ; type: undefined this item: ; type: undefined this item: _level0.QUESTION PAD.contentWidget.questionList.scrollPane.spContentHolder._item2; type: View //////////////////////////////////////////// I assumed that I was overwriting an instance name somewhere, but I also traced the contents of listContainer with a for-in loop. This is the output after the first item is added: //////////////////////////////////////////// this item: 2441; type: undefined; text: undefined ...other irrelevant stuff this item: true; type: undefined; text: undefined this item: _level0.QUESTION PAD.contentWidget.questionList.scrollPane.spContentHolder._item0; type: View; text: question 1 //////////////////////////////////////////// And this the output after the second item is added: //////////////////////////////////////////// this item: 2441; type: undefined; text: undefined ...other irrelevant stuff this item: true; type: undefined; text: undefined this item: _level0.QUESTION PAD.contentWidget.questionList.scrollPane.spContentHolder._item1; type: View; text: question 2 //////////////////////////////////////////// So it looks to me like I'm actually overwriting each _itemX instance on listContainer - and hence the references in the Collection become null pointers. Does anyone have any experience with this? Many thanks, Matt.
_______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com

