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

  • SEARCH
  • Home
  • 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 3484272
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:46:11+00:00 2026-05-18T10:46:11+00:00

I need to make an auto complete component in flex that fetches the auto

  • 0

I need to make an auto complete component in flex that fetches the auto complete results from a remote database using a webservice. I have the webservice and querying part worked out. I’ve already made custom components in action script by extending VBoxes. However I cannot figure out how to generate the popup window that is supposed to show under the text input in my auto complete text box.

Currently I am using something like

PopUpManager.addPopUp(popup, parentComponent);

My popup class extends VBox and it extends the createChildren method as follows

protected override function createChildren():void
{
  for (var i:int = 0; i < results.length; i++) {
    var itemC:UIComponent =
        factory.getComponent(results[i]);
    addChild(itemC);
    itemC.addEventListener(MouseEvent.CLICK,
        getClickFunction(i));
}

private function getClickFunction(index:int):Function {
    return function (event:MouseEvent):void
        {
            selectedIndex = index;
        };
}

Unfortunately when the webservice retrieves its results and addPopUp is called, nothing shows up.

Currently the factory.getComponent method is executing this code

public function getComponent(user:Object):UIComponent
{
    var email:Label = new Label();
    email.text = user.email;
    var name:Label = new Label();
    name.text = user.displayName;
    var vbox:VBox = new VBox();
    vbox.addChild(name);
    vbox.addChild(email);
    return vbox;
}
  • 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-18T10:46:11+00:00Added an answer on May 18, 2026 at 10:46 am

    Finally I figured out how to use the List control and I stopped using a factory to generate components, instead I use the itemRenderer feature in the list control. I also used that to replace the custom popup class, and I added a positioning function to be called later. By combining these things I was able to get the drop down to display as expected. It appears that some components do not work well as pop ups.

    Regardless, the working pop up code is

    Inside my autocomplete component which extends HBox

    dropDownList = new List();
    dropDownList.itemRenderer = itemRenderer;
    dropDownList.dataProvider = results;
    dropDownList.labelFunction = labelFunction;
    dropDownList.rowCount = results.length;
    dropDownList.labelFunction = labelFunction==null ?
        defaultLabelFunction : labelFunction;
    dropDownList.tabFocusEnabled = false;
    dropDownList.owner = this;
    PopUpManager.addPopUp(IFlexDisplayObject(dropDownList), DisplayObject(this));
    callLater(positionDropDownList);
    

    Method in the autocomplete component (textInput is my text field)

    public function positionDropDownList():void {
        var localPoint:Point = new Point(0, textInput.y);
        var globalPoint:Point = localToGlobal(localPoint);
        dropDownList.x = globalPoint.x;
        var fitsBelow:Boolean = parentApplication.height - globalPoint.y - textInput.height > dropDownList.height;
        var fitsAbove:Boolean = globalPoint.y > dropDownList.height;
        if (fitsBelow || !fitsAbove) {
            dropDownList.y = globalPoint.y + textInput.measuredHeight;
        } else {
            dropDownList.y = globalPoint.y - dropDownList.height;
        }
    }
    

    The position function was code that I borrowed from http://hillelcoren.com/flex-autocomplete/

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

Sidebar

Related Questions

No related questions found

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.