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.
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..
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.
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.
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.
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).
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?
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.
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;
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!
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.
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?
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.
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)
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?
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:
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.
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:
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
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?
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?
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.)
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.
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).
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,