Flex :: Set SelectedIndex For DownDownList?
Sep 26, 2010
I have an Array Collection as follows
var myArr:ArrayCollection = new ArrayCollection([
{label: "label1", data: "data1"},
{label: "label2", data: "data2"}]);
[Code]....
How to set the selected item for myDDL based on an item id(myID)? I tried something like:
selectedIndex = {myArr.getItemIndex(myID)}
View 1 Replies
Similar Posts:
Dec 27, 2008
I have an Array Collection as follows
myArr:ArrayCollection = new ArrayCollection([
{label: "label1", data: "data1"},
{label: "label2", data: "data2"}]);
[code]....
View 6 Replies
Feb 8, 2012
I am unable to bind the selectedIndex public property of a spark DropDownList to it's original source in the view's presentation model.
For the purposes of replicating this issue with as few lines as possible I have two views, and one presentation model. The code follows.
Main.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
[code]...
Debugging the application I find that selectedIndex in the presentation model always remains at the default value assigned regardless of which item I selected from the DropDownList. For the sample code above this is -1.How can I bind the selectedIndex in the presentation model such that it is updated appropriately when the selected item DropDownList changes?
View 1 Replies
Aug 14, 2009
In the code below, the presentedAlbumIndex is used to control the selectedIndex of the TileList. Item "five" is initially selected. Whenever the button is pressed the first item in the array is deleted, and the presentedAlbumIndex is decremented.
In theory, the selected index should stay with "five" every time the button is clicked (until "five" is itself deleted). It works this way for the first button press. However, on the 2nd button press the highlighting changes to "six" for some reason. Also, the TileList selectedIndex is always one behind.
I tried looking into ListBase and monitoring selectedIndex. It looks like the selectedIndex is updated initially to the correct index, but then it reverts back at some point to the correct index+1. I do not know why it's setting back.
It seems it's due to the fact that I am doing a data provider delete and index change in the same operation.
Is there some function in TileList I could override to keep selectedIndex up to date?
Steve
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
[Code]....
View 1 Replies
Apr 9, 2010
Is there something like selectedIndex for SkinnableDataContainer? It doesn't seem to be one of the available properties.
View 2 Replies
Feb 3, 2011
When using a dropdownlist in flex I'd like to know the exact index value when the prompt is initialized in it.
View 1 Replies
Jun 21, 2010
Isn't there a better way to accomplish this?[code]...
All I want to do is make sure that when I update the item that the comboBox is pointing to internally, that it's selectedIndex also update so that the label within the ComboBox reflects the new value.
View 1 Replies
Mar 11, 2011
I have a simple button function that changes the selectedIndex on a view stack without using the menu bar component. I call the function from the click property on the button and pass an int as the index I want to jump to. When I had the code on the application MXML file everything worked fine. After moving my actionscript to a separate file, I get access of undefined property errors:
protected function changeView(index:int):void
{
myViewStack.selectedIndex = index;
[code].....
View 2 Replies
Nov 26, 2004
I have a simple button function that changes the selectedIndex on a view stack without using the menu bar component. I call the function from the click property on the button and pass an int as the index I want to jump to. When I had the code on the application MXML file everything worked fine. After moving my actionscript to a separate file, I get access of undefined property errors:
protected function changeView(index:int):void
{
myViewStack.selectedIndex = index;
}
How do I get the .as file to recognize the myViewStack component? Do I need to reference Main.MXML somewhere in the .as file? Thanks.
Here is the rest of my code:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
[code]....
And finally the .as files with the function in question:
import mx.containers.ViewStack;
protected function changeView(index:int, myViewStack:ViewStack):void
{
myViewStack.selectedIndex = index;
}
View 3 Replies
Jun 30, 2004
I am having a real problem with one of my components. I have a list object and I need to set the selectedIndex. Now I would think this would be easy, but it appears that for just this instance the selectedIndex property is read only. I have set the property for other instances, and I can read the property for this instance, but I cannot change it.
View 1 Replies
Sep 8, 2011
when i use nextSlide() and prevSlide(), which are executed when i click on two buttons. SelectedIndex works when i click on the elements in the List. What am i doing wrong? do i have to dispatch some events? Are there any tricks to doing it with buttons?This is my playlist class
public class Playlist extends List
{
private var dispatcher:Dispatcher;
[code]......
View 2 Replies
Dec 8, 2011
I have a viewstack, which contains 3 (at this moment just 1) customcomponents:
<s:Application xmlns:components="components.*">
<mx:ViewStack id="mainViewStack" x="76" y="90" width="800" height="400">
<components:Login />
[code].....
View 1 Replies
Apr 22, 2009
In lee's xml tutorial he uses the list component and the text area component but when he tested the swf he had to select the item befour the text field was populated.
i have set the selectedIndex to 0 but the data still does not load untill an item is selected.
View 2 Replies
Mar 16, 2005
Ok I can't find any doco on this and it's driving me crazy. Anyone know how you specify the default value for the V2 ComboBox component based on the selectedItem when you don't know the selectedIndex? Here's my scenario:
I have a hardcoded combobox called "dd_names" with 50 names in it. I'm returning a dataset into Flash via a SQL query, and onload I need the dd_names dropdown to default to the value of the name returned in the dataset. So if the query returns "Tom" I need the dropdown to default to "Tom."
I tried setting dd_names.selectedItem = "Tom" and dd_names.value = "Tom" and these don't work. The ComboBox just defaults to the first item in the list.However, if I use the selectedIndex property and set dd_names.selectedIndex = 3, the ComboxBox doesn't default to the first item in the list but shows the appropriate item. This doesn't help because I don't know the selectedIndex being returned from the query - I only know the selectedItem. Anyone know how to do this??
View 4 Replies
Jun 21, 2007
I have a DataGrid bound to an XMLConnector and XMLDataSet. The XML data loads fine into the components. However, I cannot get the value of the selected index using: my_datagrid.selectedIndex
The call works fine if you use addItem to populate the grid.
Is there an issue being that the datagrid.selectedIndex parameter is bound to the XML components?
View 1 Replies
Jul 23, 2004
I've got a combo box in my movie (called news_selector), whenever the selection of the combo box changes, I want to do something. Here's my code for the combobox so far...
Code:
on(change)
{
trace("News feed changed to: " +news_selector.selectedIndex);[code].....
The problem is that the news_selector.selectedIndex bit is showing as undefined in the debug window, and thusly the if/else statements are ignored completely.
View 1 Replies
Sep 16, 2009
What's the difference between selectedChild property and selectedIndex property? I read the documentation, both seems to be setting currect active accordion. selectedChild can be only used in actionscript, but other than this, what's the difference?
View 0 Replies
Jul 6, 2010
In a simplified version of my issue, I have a ComboBox called "cb". I can set its selectedIndex to 1 (corresponding with selectedItem.label of "Red") easily with:
cb.selectedIndex = 1
However, since "Red" may not always be at a selected index of 1, if another entry is placed before it in the list, I would MUCH rather base my code on selectedItem.label, since it will always be "Red."
How do I do this? I can at least trace the label's corresponding selection index with code like:
var frameSelect:Number = cb.selectedIndex; trace(frameSelect)
Do I need some sort of loop function? Or is there a simpler way? Can I define a variable at the very start of my code that figures out what the corresponding selection index of "Red" is on that particular day? I basically need
var frameSelect:Number = cb.[Index of whatever goes with the label of "Red"]
If it useful to you, what I am doing (on a simplifed scale) is using a combo box to change the color of a movie clip. The user can click on "Blue" or "Yellow" or "Red" in the comb box, and the movie clip changes color. However, I also need a simple button that only has one outcome ("Red") where the user clicks on the button and thus sets the selected index of the combobox directly to "Red." Like I said, I can do this quite easily using the selectedIndex parameter, but this means I would have to manually update my button's code each time a new color option was added. Not remotely ideal, since the actual implementation has hundreds of colors in arrays and there will be lots of buttons creating arrangements from different comboboxes.(Say one combobox is Colors, one is Shapes, and one is Size. The end goal is to let the user experiment as much as they want through dropdowns, OR click a button like "Small green circle" to go directly to a particular outcome.)
View 3 Replies
Oct 21, 2011
where I can find info about compiling flex 4.0 sdk on flex 4.5/4.5.1 sdk.I am having troubles. compilation goes well on 4.0 but whe I compile on 4.5 or 4.5.1 I get blank swf.
Note: I have set flash player 10.2 for compilation and also as default.
View 1 Replies
Mar 4, 2010
If I create an object like so:
class Foo {
[Bindable] public var property: String;
}
The class Foo has an implicit event dispatcher to handle property change events. How can I access that without making Foo explicitly extend EventDispatcher?
View 1 Replies
Jun 11, 2010
I wish to develop a softare for 3D object compression (by polygon reduction) in flex using papervision 3D. Could you please suggest me an efficient algorithm for the same?
View 1 Replies
Jul 12, 2010
I have implemented application client-server with spring blazeDs message services using JMS message destination. The idea is a producer declared in Java send message using activeMQ and consumer declared in Flex receives them. I have configured the AMFChannel with a polling interval 0, but I have seen when the consumer subscribes to the destination in Flex, the time request can be of up to 3 seconds.
[Code]....
View 1 Replies
Aug 26, 2010
I want to send a html webpage with my application in installation package,is it possible?
View 1 Replies
Sep 17, 2010
I have an J2EE Enterprise Application Project in which I would like to add a few Flex screens. How do I go about adding Flex capabilities.
I have build Flex/J2EE applications from scratch but can't think of the best way to do this.
I am currently using Flex Builder Plugin for IBM Rational Application Developer 7.5.
View 1 Replies
Feb 11, 2011
I have a tree with nodes , and a delete button , first user select the node and click this delete button , I want this node to be removed from the tree , Its not XML , every node in tree is of type Object
{label:'folder',children:[{label:'file1'}]}
I tried delete myTree.selectedItem (but compiler wont let me do it) also tried myTree.selectedItem = null (just unselects the item)and also how can I access reference to parent object of myTree.selectedItem ?
View 3 Replies
Mar 16, 2011
im trying to output my database information in a text input field in flex by using remoteObject(cfc). The information is being provided by a database using a query and an array collection. I'm just unsure how i go about taking the queried array collection information and display it into TextInput Fields.
[Code]...
View 1 Replies
May 11, 2011
in my variable i am getting error private var friendsList:VBox; "conflict exists with definition friendlist in namespace internal" what it is?
View 1 Replies
Jun 15, 2011
I am trying to access html files protected by basic authentication. Below is the code to do that but I still get the authentication dialog. I checked the fiddler and found that for the first request authorization header is present but for the subsequent requests which is requested to load the .js, css & images the authorization header is not added. This is the reason I am getting the auth dialog.
Is there a way to add authorization header to the subsequent requests as well?
[Code]...
View 1 Replies
Aug 11, 2011
I have a TabNavigator, and each tab is a Module. One of the modules is labelled Units and the full code of the module is posted in this post. There are several problems:
1) Forms are not populated with data from the datagrid selection.
2) Selecting a row and clicking delete gives the very-common error: TypeError: Error #1009: Cannot access a property or method of a null object reference.
A trace on the valueObject unit within the selectionChangeHandler function gives NULL. Why? Note: In other modules (other tabs of the TabNavigator), I have DropDownLists populated with units. This means that the valueObject Unit is defined in the other modules. However, valueObjects should be private to modules, and not shared.
[Code]....
View 1 Replies
Dec 7, 2011
ow do you display HTML formatted text in a Spark custom item renderer (Actionscript)?
Sample Code:
The html content in item.post_content displays as plain text in the IconItemRenderer messageFunction snippet below (which is just the default generated code for Icon Item renderer):
<s:itemRenderer>
<fx:Component>
<s:IconItemRenderer iconField="iconField"
iconWidth="64" iconHeight="64" labelField="post_title" messageFunction="getPost">
[code]...
View 1 Replies