Thanks for the example Bram but it doesn't help me in this case. My
implementation is a bit more involved so let me explain the details .
My custom TileList extends TileList and is fully written in AS. The
application I'm working on has a menu like the ones that many applications
have. It has a file menu that has menu points like Open, Save As., Close
etc.
If you choose Open, it loads a file and populates the TileList with items
from the file. If you choose Close it calls the following function in the
TileList instance .
public function clear():void
{
_tileCollection = new ArrayCollection();
dataProvider = _tileCollection;
}
The odd thing is: This function is also called every time you choose Open
and it then clears the TileList and immediately loads a file and populates
the list and there it works without problem! But if you choose Close from
the menu and then choose Open, you get the exception: Error #2007: Parameter
child must be non-null.
Also I'm hanging over this problem since a couple of days now and closed and
opened Flex several times so there's no issue with the Debugger.
Thanks for any help!
Sascha
_____
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Webdevotion
Sent: Sunday, 07 January, 2007 21:53
To: [email protected]
Subject: Re: [flexcoders] How to clear a TileList of its items?
Hey Sascha,
Try to compile and use my example. Just create a new Flex Project.
Maybe you ran into a debug error. Please be sure that all your debug
sessions have stopped in the debugger by pressing the red square button.
Sometimes I have to restart my Builder in order to get rid of those compile
time errors.
Good luck ; )
Bram
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe. <http://www.adobe.com/2006/mxml>
com/2006/mxml" layout="vertical">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection ;
[Bindable]
private var collection:ArrayCollection = new ArrayCollection([{first:
'Matt', last: 'Matthews'},{first: 'Matt', last: 'Matthews'},{first: 'Matt',
last: 'Matthews'},{first: 'Matt', last: 'Matthews'},{first: 'Matt', last:
'Matthews'},{first: 'Matt', last: 'Matthews'},{first: 'Matt', last:
'Matthews'}]);
private function resetProvider():void
{
collection = new ArrayCollection();
collection = new
ArrayCollection([{first:'John'},{first:'John'},{first:'John'},{first:'John'}
,{first:'John'},{first:'John'},{first:'John'},{first:'John'},{first:'John'},
{first:'John'},]);
}
]]>
</mx:Script>
<mx:TileList id="list" dataProvider="{collection}" height="250" width="300"
maxColumns="2" rowHeight="225" columnWidth="125" labelField="first"/>
<mx:Button click="resetProvider();" label="Reset"/>
</mx:Application>