[Flashcoders] Creating a scrollable list: adding components to the scrollpane contents

2006-09-04 Thread Steve Krichten

Hi Matt,

I created something very much like what you describe.  You can have a 
look at it here...


http://www.sleekdigital.com/News/5.aspx


 [Flashcoders] Creating a scrollable list: adding components to the
 scrollpane contents

*Matt Bennett* bennett.matthew at gmail.com 
<mailto:flashcoders%40chattyfig.figleaf.com?Subject=%5BFlashcoders%5D%20Creating%20a%20scrollable%20list%3A%20adding%20components%20to%20the%0A%09scrollpane%20contents&In-Reply-To=>

/Fri Sep 1 02:00:10 EDT 2006/

   * Previous message: [Flashcoders] Flash player cache? <172153.html>
   * Next message: [Flashcoders] Creating a scrollable list: adding
     components to the scrollpane contents <172211.html>
   * *Messages sorted by:* [ date ]  [ thread ]
  [ subject ]  [ author ]
 



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.


___
Flashcoders@chattyfig.figleaf.com
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


Re: [Flashcoders] Creating a scrollable list: adding components to the scrollpane contents

2006-09-02 Thread Jeroen Beckers
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.
___
Flashcoders@chattyfig.figleaf.com
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

___
Flashcoders@chattyfig.figleaf.com
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


[Flashcoders] Creating a scrollable list: adding components to the scrollpane contents

2006-08-31 Thread Matt Bennett

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.
___
Flashcoders@chattyfig.figleaf.com
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