Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1096343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:16:15+00:00 2026-05-17T00:16:15+00:00

I have an Array Collection as follows var myArr:ArrayCollection = new ArrayCollection([ {label: label1,

  • 0

I have an Array Collection as follows

var myArr:ArrayCollection = new ArrayCollection([
                {label: "label1", data: "data1"}, 
                {label: "label2", data: "data2"}]); 

And a dropdownlist

<s:DropDownList id="myDDL"
                dataProvider="{myArr}" />

How to set the selected item for myDDL based on an item id(myID)? I tried something like:

selectedIndex = {myArr.getItemIndex(myID)}

But it didn’t work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T00:16:15+00:00Added an answer on May 17, 2026 at 12:16 am

    Did you set the selectedIndex in MXML? Or ActionScript? Since you use binding syntax, it makes me think that you want to use MXML. You can’t bind to the results of a function; only to a property. Internally, binding uses “propertyChange” events so that Flex knows when a value changes. The event is dispatched in the setter function (for most properties implemented in the Flex Framework).

    There is no equivalent parallel for functions. You should be able to do an assignment in AS3 w/o any problems, though:

    selectedIndex = myArr.getItemIndex(myID)
    

    You need to make sure that ‘myID’ is an element of your dataProvider, though. Something like this should, in theory, work:

     myID = {label: "label1", data: "data1"}
    

    However, it may be possible that the ‘getItemIndex” checks for the memory location, not an actual value comparison. If so, then you’ll need to do something like this:

     myID = myArr[0]
    

    For the code to work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array as follow. var array:Array = new Array(); array[Circle] = 1;
I have a collection (or list or array list) in which I want to
I have a Collection<T> property that wraps a array like T[] array; public Collection<T>
I have a collection with 1.5 million documents. I'm counting using PHP: $db->some->ensureIndex(array(sometext =>
I have to enumerate through the members of a collection and create an array
Here is my problem I have arraycollection with the attribute Month with similar data
I have an ArrayCollection of objects. I'm passing this array to a horizontallist as
i done as follows i have a method with brings data of particular table,
I have collection as follows . { name : pqr , loc : [
I have a collection of Markers in an array which were pushed when user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.