getItem returns whatever is at the index you are hover over.
So, if it's a string, you'll get:
var o = getItem ( myTileList, 2, 2 );
trace(o); // Cow
If it's an Object with the fields label, and data, you'll get this:
trace(o); // [object Object];
trace(o.label); // Some Label
trace(o.data); // 42
If it's a class object, like a ValueObject, you'll get the ValueObject:
var person:PersonVO = new PersonVO("Jester", "XL");
my_collection.addItem(person);
// later...
var o:PersonVO = getItem ( myTileList, 2, 2 ) as PersonVO;
trace(o.firstName); // Jester
You've already got the power... use it for teh w1n!
----- Original Message -----
From: "Ethan Miller" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, July 19, 2006 5:20 PM
Subject: Re: [flexcoders] Getting Data Out of Rollovers in TileLists
Awesome, and thank you. But in your example the array contains only a
string. My array contains objects with a variety of fields/values
which I need to get at... Any way to easily modify your example to
get at these fields? We're close!
thanks! ethan
> Use indicesToIndex using the rowIndex and columnIndex on the event.
>
> ...It's all in the wrist, suckaz!
>
> http://pastebin.de/9325
>
> ----- Original Message -----
> From: "Ethan Miller" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Wednesday, July 19, 2006 1:44 PM
> Subject: Re: [flexcoders] Getting Data Out of Rollovers in TileLists
>
> I've tried both. Either works for sending the event to the showInfo
> function (the Alert triggers, etc.). The problem is how to reference
> the various fields of data of the rolled over item, ie I need the
> rollover equivalent of selectedItem (something like rolledOverItem,
> which doesn't exist)...
>
> cheers, ethan
> > You said you tried itemRollOver, but in the code, you are using
> > rollOver,
> > not itemRollOver as the event for TileList.
> >
> > ----- Original Message -----
> > From: "Ethan Miller" <[EMAIL PROTECTED]>
> > To: <[email protected]>
> > Sent: Wednesday, July 19, 2006 12:58 PM
> > Subject: Re: [flexcoders] Getting Data Out of Rollovers in TileLists
> >
> > selectedItem doesn't work because no item is selected, it was only
> > rolled over. Surely there's a way to catch the data of a rolled over
> > item? Anyone?
> >
> > cheers, ethan
> >
> > > Maybe event.target.selectedItem?
> > >
> > > ----- Original Message -----
> > > From: "Ethan Miller" <[EMAIL PROTECTED]>
> > > To: <[email protected]>
> > > Sent: Tuesday, July 18, 2006 6:10 PM
> > > Subject: [flexcoders] Getting Data Out of Rollovers in TileLists
> > >
> > > Greetings -
> > >
> > > I'm trying to get data out of a dataProvider (the 'orientation'
> > > field) used by a tileList, on rollover, not on selection. But, as
> > > there's no "selectedItem" in the returned event I'm not sure
> how to
> > > reference the rolled over item. The docs suggest using
> itemRollOver
> > > but the compiler claims not to know about it...
> > >
> > > Here's some sample code (using an alert to see if the data is
> being
> > > caught), my question is how to refernce the fields in the
> > > dataProvider (of the rolled over item) after e.currentTarget ...
> > >
> > > <mx:Script>
> > > <![CDATA[
> > > import mx.controls.Alert;
> > > import flash.events.Event;
> > > import mx.events.ListEvent;
> > >
> > > private function showInfo(e:Event):void {
> > > Alert.show(e.currentTarget.itemRollOver.orientation, "Data
> > > Found...", Alert.OK);
> > > }
> > > ]]>
> > > </mx:Script>
> > >
> > > <mx:ArrayCollection id="mediaLibraryDP">
> > > <mx:Object
> > > orientation="landscape" space="RGB" date="07/18//2006"
> > > source="Apps/Content/Images/back.png"/>
> > > <mx:Object
> > > orientation="landscape" space="RGB" date="07/18//2006"
> > > source="Apps/Content/Images/side.png"/>
> > > <mx:Object
> > > orientation="landscape" space="RGB" date="07/18//2006"
> > > source="Apps/Content/Images/stomach.png"/>
> > > <mx:Object
> > > orientation="landscape" space="RGB" date="07/18//2006"
> > > source="Apps/Content/Images/couple.png"/>
> > > </mx:ArrayCollection>
> > >
> > > <mx:TileList
> > > dataProvider="{mediaLibraryDP}"
> > > rollOver="showInfo(event)"
> > > rollOut="hideInfo()">
> > >
> > > <mx:itemRenderer>
> > > <mx:Component>
> > > <mx:Image source="{data.source}"/>
> > > </mx:Component>
> > > </mx:itemRenderer>
> > > </mx:TileList>
> > >
> > > Thanks! ethan
> > >
> > > --
> > > Flexcoders Mailing List
> > > FAQ: http://groups.yahoo.com/group/flexcoders/files/
> > flexcodersFAQ.txt
> > > Search Archives: http://www.mail-archive.com/flexcoders%
> > > 40yahoogroups.com
> > > Yahoo! Groups Links
> > >
> > >
> > >
> >
> > --
> > Flexcoders Mailing List
> > FAQ: http://groups.yahoo.com/group/flexcoders/files/
> flexcodersFAQ.txt
> > Search Archives: http://www.mail-archive.com/flexcoders%
> > 40yahoogroups.com
> > Yahoo! Groups Links
> >
> >
> >
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: http://www.mail-archive.com/flexcoders%
> 40yahoogroups.com
> Yahoo! Groups Links
>
>
>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
------------------------ Yahoo! Groups Sponsor --------------------~-->
Yahoo! Groups gets a make over. See the new email design.
http://us.click.yahoo.com/XISQkA/lOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/