Link to home
Start Free TrialLog in
Avatar of Jay Roy
Jay RoyFlag for United States of America

asked on

capture selected value from mouseover

hi guys


i have a requirment where i have a label . when user puts the cursor on the label
a small window should popup and show the usernames from an ArrayCollection. When a username is clicked the clicked username should be passed to backend.

Here is the mxml

<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
      xmlns:projectWork="org.view.projectWork.*"
      xmlns:projectNav="org.view.projectNav.*"
      creationComplete="init()"
      styleName="dashBoardPage"
      xmlns:services="services.*">

<mx:Script >
<![CDATA[
import org.entity.project.ProjectSummaryDTO;
[Bindable]
public var users:ArrayCollection;  --> this collection has a list of usernames
public var selectedusername:String; -->holds the selected username
                  
<mx:Label styleName="usernames" text="show users"/>  --when user puts mouse here, a window should popup and show the usernames from 'users' Arraycollection

<mx:VBOX>

If 5 usernames are displayed in the box , when user clicks on a username i need to capture that username and pass it to the backend.
So i have created a string var 'selectedusername' which will contain the selected username.

Am i in the right direction?
Can anyone please help me with some code

thanks
Avatar of dgofman
dgofman
Flag of United States of America image

Why you cannot user component List and show all 5 usernames as dataProvider
when user click on row you will listen itemClick event and set selectedusername - event.target.selectedItem;
Avatar of Jay Roy

ASKER

by dataprovider do you mean datagrid? I dont want to use a datagrid. My boss wants a pop-up window when the mouse cursor is placed on the label. Is that possible?

thanks
Everything is possible just need to know what you want

<mx:Script>
            <![CDATA[
                  import mx.controls.Alert;
            ]]>
      </mx:Script>
      <mx:Label styleName="usernames" text="show users" mouseOver="Alert.show(event.target.text)"/>

Avatar of Jay Roy

ASKER

Ok cool.. When I click on a username I need to pass the username to my
java backend. Any idea how I can do that?

Thanks for the help
what services are you using? RemoteObject, WebService or HttpService?
Avatar of Jay Roy

ASKER

using RemoteObject to call java methods. So i am basically passing the selected username
to the backend java method.

thx
ASKER CERTIFIED SOLUTION
Avatar of dgofman
dgofman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jay Roy

ASKER

cool, thx very much

>><mx:Label text="Current Selected User is '{selectedUser}'" click="selectUser(event)"/>
Instead of click, i should be able to do 'mouseover' ,right ?

you can assign any events for Label component. (focus, mouseOver, mouseDown, click etc..)
Avatar of Jay Roy

ASKER

thanks.

trying to impliment this , have a question

You have      

    <mx:arguments>
    <user>{selectedUser}</user>
    </mx:arguments>
i understand the arguments tag, but can you tell me what is <user> tag? Is this a tag in Flex?

thanks.
Avatar of Jay Roy

ASKER

thx v much, it works perfectly.

can you please help out with the next question
https://www.experts-exchange.com/questions/26916522/display-data-in-multiple-rows.html

thx.