Actionscript 3 :: Flex: Special-casing An Item In A List Or Menu?
Aug 4, 2009
I've found it's often useful to special case the first item in a drop-down menu (ie, an instance of Menu). For example, if I want to pick a color from the list provided by a web service:
I might also want a special-case, which is "enter a new color", allowing the user to enter the RGB values for a new color which isn't in the list. For example:
var newColor = { label: "Enter a new color", rgb: null };
I'm trying to get the menu width of a menu item in flex 4. I can get it but I have to show the menu first, then hide the menu, do a calculation, and show it again. Is there an easier way to get the item menu width without this hassle?
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;
i need to fire separate method for individual menu item clicked ,so that individual item can handle separate method.and i need know what all the properties are available in menu item like type="radio".
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.
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.
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,
I have a dropdownlist of "Select an employee" which is optional. I need it to have "No one" at the top so that user can change back to NoOne if he' ve already chosen "John Someone".
My question is how to keep the prompt item, or add a dummy item at -1 without changing the dataprovider (I really hate adding "No one" to the original employeeList dataprovider)
[URL]
Flex 4 Drop Down List - bound with data service, how to always keep prompt or add item at index -1 programmatically
I have a list with custom item renderers. What I would like is when one of the list items is selected to position another control OUTSIDE the list to the same vertical position as the selected item.
I have a regular spark list which is sorted correctly when no item renderer is used. However, when the following item renderer is used, the list shuffles and displays items from previous instances of the list.[code]
I'm setting selected element in s:List component with Actionscript, it works, but List doesn't scroll to selected item -- need to scroll with scrollbar or mouse. Is it possible to auto-scroll to selected item
In Flex 4 (beta 2), I have a list control populated from an XMLListCollection. What I would like to do is when an item is selected in the list, use a custom item renderer on the selected item as well as the item that appears just prior to the selected item in the list.
I am using a spark list control, but I am open to alternate components if the solution makes sense.Here is the strucutre of the xml used to populate the XMLListCollection
Is it possible to make an item in a List control not selectable? If so, how would this be accomplished?
I've tried one thing so far. What I did was use a custom item renderer that checks for a value in the data property upon a FlexEvent.DATA_CHANGE event. If that value is not set, I tried setting the item renderer's selectable property to false. This, unfortunately, does not seem to work.
I have a List component using multiple item renderers determined by the itemRendererFunction. When I set the data the first time, it works as expected. Then, when I set the data a second time with new data, it doesn't call the itemRendererFunction and tries to reuse the current renderers even though they don't match the data.Once I scroll, the function is called and the correct renderers are used. I tried calling invalidateDisplayList and such prior to setting the data, but that didn't fix the problem.