Erin,
 
It looks like your array:
    var arrTest:Array = [1,2,3,4];
just contains numbers.
 
IList(myTiles.dataProvider).getItemAt(1) should return 2;
 
2 is just a number so you it doesn't have a testFunction
 
Did you intend to pass 2 into testFunction?
 
That would be:
    testFunction(IList(myTiles.dataProvider).getItemAt(1));
 
One good way to debug this is to start storing parts of the expression
in temporary variables.
 
-Alex

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of erinwyher
Sent: Thursday, April 12, 2007 10:41 AM
To: [EMAIL PROTECTED]
Subject: [flexcoders] Re: Tilelist in Flex 2 - what to use instead of
getItemAt()?



Thanks for the suggestion. My new error is: value is not a function.
This comes up on this new line:

IList(myTiles.dataProvider).getItemAt(1).testFunction();

-Erin

--- In [EMAIL PROTECTED] <mailto:flexcoders%40yahoogroups.com>
, "craig.drabik" <[EMAIL PROTECTED]>
wrote:
>
> Try using an ArrayCollection for your data provider instead of a
> simple array. 
> 
> --- In [EMAIL PROTECTED]
<mailto:flexcoders%40yahoogroups.com> , "erinwyher" <erinwyher@> wrote:
> >
> > Thanks for the suggestion, but it doesn't work :(. Do you need the
> > latest version of Flex 2 for that to work? I didn't install the
latest
> > upgrade (2.1 I believe).
> > 
> > When I tried it, I got the following error.
> > 
> > TypeError: Error #1006: value is not a function.
> > at test/clickedList()
> > at test/___Button1_click()
> > 
> > Also, in the debugger, IList(myTiles.dataProvider) cannot be
evaluated,
> > and neither can IList(myTiles.dataProvider).getItemAt(any_number)
> > 
> > Any more ideas? I really need help with this and I appreciate any
> > suggestions! Thank you.
> > 
> > -Erin
> > 
> > --- In [EMAIL PROTECTED]
<mailto:flexcoders%40yahoogroups.com> , "bhaq1972" <mbhaque@> wrote:
> > >
> > > the getItemAt() function is available but not like the flex 1.5
way.
> > >
> > > you can do the following
> > >
> > > import mx.collections.IList;
> > >
> > > public function clickedList():void {
> > > //myTiles.getItemAt(1).testFunction();
> > > IList(myTiles.dataProvider).getItemAt(1).testFunction();
> > > etc
> > >
> > >
> > >
> > > --- In [EMAIL PROTECTED]
<mailto:flexcoders%40yahoogroups.com> , "erinwyher" erinwyher@ wrote:
> > > >
> > > > In Flex 1.5, you use getItemAt() to call functions from the
> > > children
> > > > of the TileList, but that method no longer exists in F2. Any
> > > > suggestions to do this?
> > > >
> > > > Here is some sample code:
> > > >
> > > > test.mxml:
> > > > <?xml version="1.0" encoding="utf-8"?>
> > > > <mx:Application
> > > > xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> "
> > > > xmlns:view="view.*"
> > > > layout="absolute"
> > > > creationComplete="doInit()">
> > > > <mx:Script>
> > > > <![CDATA[
> > > > public var arrTest:Array;
> > > >
> > > > public function doInit():void {
> > > > arrTest = [1,2,3,4];
> > > > myTiles.dataProvider = arrTest;
> > > > }
> > > > public function clickedList():void {
> > > > //myTiles.getItemAt(1).testFunction
> > > ();
> > > > //I want to call a function here for
> > > a specific set of tiles...
> > > > how do I do that without getItemAt?
> > > > //Note: getChildAt does not work
> > > either
> > > > }
> > > > ]]>
> > > > </mx:Script>
> > > > <mx:Button label="click me" click="clickedList()"/>
> > > >
> > > > <mx:TileList id="myTiles" width="660"
> > > itemRenderer="view.TestComponent"/>
> > > >
> > > > </mx:Application>
> > > >
> > > > TestComponent.mxml
> > > > <?xml version="1.0" encoding="utf-8"?>
> > > > <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " width="40"
> > > > height="30" backgroundColor="#FF3366">
> > > > <mx:Script>
> > > > <![CDATA[
> > > > import mx.controls.Alert;
> > > >
> > > > public function testFunction():void {
> > > > Alert.show('hi');
> > > > }
> > > > ]]>
> > > > </mx:Script>
> > > > </mx:Canvas>
> > > >
> > >
> >
>



 

Reply via email to