Flex :: Select & Deselect Same Item In <s:List> With A Mousedown?

Dec 14, 2010

In Flex 4, I have a Spark List component with item renderers. I would like to select an item in the List by clicking on it, and deselect it also, by clicking on the same selected item. Like an on/off switch.

My item renderer has the following states:

<s:states>
<s:State name="normal"/>
<s:State name="hovered"/>
<s:State name="selected"/>
</s:states>

so I tried to add a click event listener to the item renderer with:

private function selectUnSelect():void {
if (currentState == 'selected') currentState = 'normal';
else currentState = 'selected';
}

with an awkward behaviour... where the item stay selected even after clicking it again in the selected state.

Think of using the List component without the Command (on mac) or the Control button on windows.

View 2 Replies


Similar Posts:


Flex :: Unable To Select Item In Spark.components.List After De-selection

Dec 21, 2010

I have a spark List defined as:

<s:List id="symbolList" dataProvider="{symbolListCollection}" change="symbolNameChangeHandler(event)"></s:List>

With the change handler defined like this:

protected function symbolNameChangeHandler(event:IndexChangeEvent):void {
symbolList.validateProperties();
changeSymbolView(symbolList.selectedItem);
}

and symbolListCollection as an ArrayList filled with Strings.

At first, the change event works fine, and I get what I expect.

However, if I Ctrl-click on the selected item, to de-select it, i am unable to ever select an item again.

When I click on something to try to select it, the change event DOES fire, however, the ItemChangeEvent has both oldIndex and newIndex set to -1

View 1 Replies

Flex :: Flash - Programmatically Select An Item In A List After DataProvider Is Updated?

Jan 2, 2011

I have a Spark List container whose dataProvider is bound to a result set coming back from a RemoteObject call. Pretty standard stuff.

<s:List id="list" dataProvider="{model.stuff}" width="100%" height="100%"
selectedIndex="@{selectedSlider.value}"
itemRenderer="{stuffRenderer}">
</s:List>

The selectedIndex is associated with an HSlider, but that is not the problem. My issue is that I would like to automatically select a certain "preferred" element from the list (only initially...to guide the user).

I tried to do that in a creationComplete event but my data hadn't shown up yet...setting selectedIndex didn't work..

View 3 Replies

ActionScript 2.0 :: Select An Item From List Component And Fire A Function Directly Related To Selecting That Item

Jul 13, 2009

I want to be able to select an item from my list component and fire a function directly related to selecting that item. list is called "tidlist" function is "selecttid(n)" the "n" needs to be replaced with the index number... so if run my swf and the list component displays my items... when i select one (the third one for example)... i want to fire "selectTid(3)".... cant seem to grasp.

View 1 Replies

Actionscript 2.0 :: Select An Item From List Component And Fire A Function Directly Related To Selecting That Item?

Jul 13, 2009

I want to be able to select an item from my list component and fire a function directly related to selecting that item.

list is called "tidlist"
function is "selecttid(n)"

the "n" needs to be replaced with the index number... so if run my swf and the list component displays my items... when i select an item (the third one for example)... i want to fire "selectTid(3)".... cant seem to grasp.

View 1 Replies

Flex :: Select/deselect All Checkbox In Datagrid?

May 3, 2011

i am using below code to select/deselect all checkbox in datagrid

<mx:DataGridColumn id="testColumn" width="20" sortable="false">
<mx:headerRenderer>
<fx:Component>
<mx:Canvas>

[code]...

i want to unselct checkAll checkbox when i deselect any of row checkbox,i am trying to access value of checkAll to check_clickHandler(), but i am not getting its value.

View 1 Replies

Flex :: Select Item In Details Form Dropdown When Datagrid Item Is Selected

Feb 15, 2011

I have this datagrid:

<mx:DataGrid id="dgCompetenteN" includeIn="Test" left="10" right="472" top="69" bottom="149"
dataProvider="{colCompetente}" editable="false">
<mx:columns>

[Code]....

What I want to do is, when I select an item in the datagrid, the selected item of the dropdown should be the correct one (the one which has the field idCompSuperioara equal to the third element in the selected datagrid row).

View 1 Replies

ActionScript 3.0 :: EventListener - Select / Deselect Sprite On Stage

Oct 26, 2010

I have the following code:
Code:
btn.addEventListener(MouseEvent.CLICK, select);
function select(evt:MouseEvent):void {
addEventListener(MouseEvent.CLICK, unselect);
} function unselect(evt:MouseEvent):void {
removeEventListener(MouseEvent.CLICK, unselect);
}
The idea is to be able to select the "btn" sprite and while it is selected you can click anywhere on stage to deselect it. I thought this would work but somehow after a single mouse click it also executes the unselect function. Since I add this function after the mouseclick I do not understand why it is doing this. Is this not the way to do such a thing?

View 6 Replies

ActionScript 3.0 :: Select / Deselect Each Checkbox And Save The Selection Out To An Xml File

Aug 2, 2010

I have a movieclip that contains some checkboxes "preferences_mc". I have an xml file that is loaded in and has an element called "isUnique" which has children with unique names like id, title, version and such. What I am trying to accomplish is for the form I am building to be able to select/deselect each checkbox and save the selection out to an xml file. I have gotten that far and everything is working perfectly. My problem is that after I load the xml back in and try to set the checkbox.selected = xmlPrefs.isUnique.id to get the checkbox to use the data from the xml file to decide whether it is selected or deselected, it ALWAYS selects the box whether it is true or false. I have tried everything. xmlPrefs.isUnique.id traces out as false which is correct but the screen still shows the checkbox selected.

[Code]...

View 3 Replies

Flex :: Get List Item Selection Working When Using A Png Mask In An Item Renderer In A 4.5 Mobile App?

Jun 10, 2011

I'm creating a mobile app in which I need to show a calendar with months at the top. The months are part of a component that extends from SkinnableDataContainer (and has some custom scrolling/behaviour - which is why I did'nt use a spark list). I need the months to be shown as a 'trapezium' shaped tab and so I'm using a png image as a mask in the item renderer for the component.

When the mask is not applied, it all works well - the months render, the list/data container selection works when I click on a month and so on.When the mask is applied, it renders well, scrolling and everything else seems to work well - but when I click on a month, nothing happens visually. And from the trace statements in my code, it appears list item selection is not changing. Looks like mouse clicks are not working.

Code:

public class TopCalendarMonthRenderer extends LabelItemRenderer {
[Embed(source="/assets/trapezium_alpha.png")]
private static var TrapeziumMask:Class;
private static var trapeziumMaskInstance:BitmapAsset;

[code]...

View 1 Replies

ActionScript 2.0 :: List Component - How To Deselect Object

Jan 8, 2007

Is there an AS command that deselects (i.e. un-highlights) an object in a list component? Once a selection is made and a button is hit, I want the selection to go back to nothing!

View 4 Replies

Flex :: Unable To Select Custom Item Renderer?

Jul 25, 2009

I have made the following item renderer in mxml, but when I use it in a list for some reason I can not select it. Am I doing something wrong?

<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml"
horizontalScrollPolicy="off">
<mx:Script>

[code]......

View 2 Replies

Flex :: Datagrid, Select An Item Given My Data Attribute Values?

May 6, 2010

I'm using a custom component CheckBoxList DataGrid (http://blogs.adobe.com/aharui/2008/02/checkbox_selection_in_datagrid.html) and as dataProvider I have an ArrayCollection with items such this one:

name="item name" selected="true"

I would like the CheckBox list updated when the selected attribute is set to false or true in the data model.

View 1 Replies

Flex :: Show Email In Textbox When User Select Any Item In The Grid?

Feb 2, 2010

i have following xml

<?xml version="1.0" encoding="UTF-8" ?>
<Users>
<User>
<ID>SMSUser(63)</ID>

[CODE]...

How can i show Email in textbox when user select any item in the grid?

View 2 Replies

Flash :: Flex - Combobox Drop Down Halted When Select One Item And Show Alert?

Feb 3, 2012

Here is my code.I run this code on change event.

for(var i:uint =0; i< model.medicalHistoryDTOListByPatient.length; i++)
{
if(formatDateTime.format(model.medicalHistoryDTOListByPatient[i].VisitDate) ==

[code]......

View 1 Replies

Flex :: Auto-select The First Index In A Sparks List Control?

Apr 11, 2010

i have a spark List control. it has a dataProvider that shows reply from twitter search.i have created a function for change handler like this:

protected function list_changeHandler(event:IndexChangeEvent):void
{
ta.text = coverflow.selectedItem.title;
}

so, whenever i select each of the items in the List i will see the message(ta.text)but now, instead of me manually clicking the first time, i want it to automatically click/select the first item and see the first message(ta.text)how do i do it?

View 4 Replies

Flex :: Highlight Item In Spark List?

Jun 25, 2010

I have two spark lists and want to drag items from one list to the other. When im dragging an item and over the other list item, i want the target item to change the background coloer.Basically instead of showing the black line indicating that I will drop between elements, I want to see the target item highlight.

View 1 Replies

Flex :: Showing List Item Tooltips?

Oct 11, 2010

I have a list of objects containing an icon, a label, and a tooltip. I want to show only the icon and the label. The tooltips should be visible on mouse over an item.

Is there a way i can achieve this without writing my own mouse-over/out functions?

(notice that dataTips are a different thing as they are displayed only when the label is cut)

View 2 Replies

Flex :: Drag-and-drop Onto List Item?

Oct 21, 2010

I have a List with an item renderer and would like to enable drag-and-drop onto the items in the list, rather than adding the data to the list. Is it possible to find the item that is being hovered over when dragging?

View 1 Replies

Flex :: Spark List Item Renderer

Nov 29, 2010

How do I wordwrap in a spark list w/ an itemrenderer? This posting at[URL] works 100% but when I try to set a separate item renderer, I can't get the word wrapping...instead, I get an ugly horizontal scroll bar. HEre is my mxml:

[Code].....

View 1 Replies

Flex :: Removing All Iterates Through Each Item In List

Mar 12, 2011

When would you want to use removeAll() vs just new ArrayCollection when you want to clear an array collection. Remove all iterates though each item in the list. I can't see a case when I would want to use it.

View 1 Replies

Flex :: Get Changed Value Of Item From ItemRenderer In List?

Jun 22, 2011

I have a List with textInput as itemrenderer. Initially the list is loaded with data from a data provider. However since the items are rendered in textInputs, I have the ability to change the value of a particular item.

But when trying to access the value of the changed item using the function below, I still get the old value in my trace:

private function addItem(event:Event):void {
trace(myDataProvider.getItemAt(myList.selectedIndex).label);
}

what I need to do for the new value to be available. My itemrenderer is shown below:

<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"

[Code].....

View 1 Replies

Insert New Item In Sharepoint List From Flex?

Jul 19, 2011

i m trying to insert new item on sharepoint list from flex using sharepoint-as3-connector

[Code]...

View 1 Replies

Flex :: Accessing Value Of Selected Item In A List?

Sep 2, 2011

I'm having a problem with getting the value of an item that the user selects in my mobile Flex application. When I select an item from the list I place that item into an ArrayCollection. But when I check the value (trace()), the value is [object Object] and I can't seem to access the actual value of the object. Here is what I am doing:

private var selectedPlayers:ArrayCollection = new ArrayCollection();
private var numOfPlayers:int;
...
//check if item is not already in selected players list

[code]....

View 2 Replies

Flex :: Caching Images In List Item Renderer?

Oct 20, 2009

I have a List and the item renderer displays an image. Whenever you scroll the list, and the item renderer refreshes, it redownloads the image. Causing there to always be a delay. Is there some way of caching it so it doesn't have to redownload every time causing a delay in showing the image every time you scroll the list?

View 3 Replies

Flex :: Find The List Item Currently Under The Mouse Pointer?

Feb 3, 2010

I have some List and TileList controls. How can I get a reference to the list item that's currently under the mouse pointer?

View 3 Replies

Flex :: How To Set Variable Size For List Control Item

Jun 17, 2010

The following code display a list of comments using List control. The item height set to a fixed value (150), so it seems working: if the content is too long, the scrollbar shows. However, what I really want is not to set the height but let it to change according to the content size. Is there any way to accomplish this?

<mx:List id="commentList" width="100%" dataProvider="{commentSet.commentArrayColl}" rowCount="{commentSet.commentArrayColl.length}" >
<mx:itemRenderer> <mx:Component>
<mx:VBox width="100%" height="150" >
<mx:Text text="{data.commentContent}" />
<mx:Text text="{data.username} ({data.modified})"/>
</mx:VBox> </mx:Component>
</mx:itemRenderer> </mx:List>

To be more clear, I don't want to set the itemRenderer's VBox height to "150" or any other fixed value - but it'll only show one line of the text if I don't do it. So I'm looking for a way out of this. (If the VBox is not inside the itemRenderer, it'll auto adjust height as Text field string length grows - that's what I want.)

View 2 Replies

Flex :: Get The Item Renderer That Is At The Top Of The Viewport In A Spark List?

Oct 26, 2010

I have a Flex Spark List (well it's a Tree to be precise but it renders as a list) and as I'm scrolling through it I want to provide information about the item that is currently at the top of the list in context to the viewport. So this could be the 100th item in the list depending on how far you've scrolled down.

View 1 Replies

Flex :: How To Add Spark List Item Custom Properties

Jan 3, 2011

I'm trying to make a simple flash application providing interface for taking tests as a high school assignment. One of the requirements is to use an XML file as data source.Now, having a List component bound to the XML file with questions consisting of data such as question body, question type (ie. single choice, multiple choice, open, image etc.) and possible answers (where applicable), I was wondering if I could add some additional data (and what is the best possible way to do so) to each question upon its transfer to the List component.

I am trying to achieve two main goals with this: firstly, to mark the questions to which an answer has already been given, like with such code in ItemRenderer class:
<s:Label color="{data.color}" text="{data.label}"/>
Where data.color would be set whenever the user gives an answer to a question.
Secondly, while at it, I thought of such possibility as a great way to store answers given to particular questions. In this case, the Class of the answer object would have been Object, since there has to be many type of questions (where the answer could also be a Bitmap for example).

View 2 Replies

Actionscript 3 :: Flex / Using Multiple Item Renderers In A List

Feb 23, 2011

I'm trying to have multiple item renderers in a list, as I have several different types of objects that I want to display. I tried creating a new class that extends ListBase, and adding override public function createItemRenderer with my code within this function. I then instantiate the new class and give it my array of data as its dataProvider, but createItemRenderer is never called within my new class,

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved