Accessing data from a List item on mouse over

Below is a short example in Flex on how to access data from a list item on mouse over. I’m using the rowIndex property of itemRollOver event to access the index at which the mouse is currently positioned.

<?xml version=”1.0″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml”>

	<mx:Script>
		<!&#91;CDATA&#91;
		    import mx.events.ListEvent;
		
		    var oceans:Array = &#91;"Pacific", "Atlantic", "Indian", "Artic", "Southern"&#93;;
		
		    public function displayItem(event:ListEvent):void {
		    displayTxt.text = displayList.dataProvider&#91;event.rowIndex&#93;;
		    }
		&#93;&#93;>
	</mx:Script>

	<mx:List id="displayList"
		dataProvider="{oceans}"
		itemRollOver="displayItem(event)" />

	<mx:TextArea id="displayTxt"/>

</mx:Application>
Advertisements
Tagged ,

5 thoughts on “Accessing data from a List item on mouse over

  1. Abhay K. says:

    hey

    Its a great solution,
    thanx for this wonderful solution

  2. ravisankar says:

    verygud posting

  3. Andy says:

    Nice. Glad to come upon your post.

    Andy

  4. Jaydeep Tank says:

    How Will i get rendered value instead of Dataprovider value. I have used renderer for columns

  5. Sophi says:

    Hi, its a great solution for Menu Item list. Do you know if we can get the same functionality, when user puts his mouse cursor on a folder in sharepoint, so that it gives the text list of items inside it??

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Advertisements