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 6210371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:08:52+00:00 2026-05-24T06:08:52+00:00

In main.mxml I have a bunch of textInput controls a combobox and a few

  • 0

In main.mxml I have a bunch of textInput controls a combobox and a few checkboxes that I would like to be able to clear with some sort of loop. Right now, I do it like this:

public function clearAll():void
{
  customerIDInput.text = "";
  listIDCombo.selectedItem = "";
  listVersionInput.text = "";
  suppressMasterFilesInput.text = "";
  priorOrderSuppressInput.text = "";
  onePerSelectInput.text = "";
  geoCountOptionsInput.text = "";
  keyCodeInput.text = "";
  nthSelectInput.text = "";
  geoTypeInput.text = "";
  geoValueFromInput.text = "";
  latitudeInput.text = "";
  longitudeInput.text = "";
  begRadiusInput.text = "";
  endRadiusInput.text = "";
  geoSelectOmitCheck.selected = false;
  fieldIDInput.text = "";
  fieldValueInput.text = "";
  fieldSelectOmitCheck.selected = false;
  outputFieldCheck.selected = false;
}

I read a post on SO that recomended adding the controls to an ArrayCollection with the creationComplete event. I tried that and it worked fine but it was not any more elegant than what I have now. All of these controls are in mxml format and not generated with AS by me. I also tried looping like this:

for each (var ctrl:UIComponent in Application)
{
  switch(ctrl.className)
  {
    case TextInput:

I can’t get past that part though. I cannot find a way to reference the values of the control. Anyone know?

  • 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-24T06:08:53+00:00Added an answer on May 24, 2026 at 6:08 am

    I’d probably do it the way you do it. Is there a compelling reason not to do it this way? Given the naming conventions, I am guessing you have an explicit number of defined controls at compile time. It does not appear that you have an unknown number.

    You could work out a loop for all the children of the component:

    for (var index:int=0;this.numChildren ; x++){
     var component : UIComponent = this.getChildAt(index) as UIComponent;
     if(component is TextInput){
       component.text = '';
     } else if (component is ListBase){
       component.selectedIndex = null;
     }
     // etc for other comp types
    }
    

    But, it seems like you’re adding undue processing; making your code harder to develop; and harder to read.

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

Sidebar

Related Questions

This is what i have: Main.mxml: <fx:Style source=Main.css/> <s:TextInput x=72 y=95 focusColor=#CECB02 prompt=E-mail: skinClass=components.TextInputSkin/>
Say I have code in my main mxml and in a function like this:
Please enlighten this flex noob. I have a remoteobject within my main.mxml. I can
I have several Adobe Flash Builder projects for 4.6. in the main template mxml,
I love MXML but am starting to notice some of its drawbacks. The main
I have an ArrayCollection that shows up on the main screen of my app.
I'm working on an app that, from the Main.mxml, opens one or many Window.mxml
I have 2 files: Main.mxml with application and one MyObject.as. I create the instance
I have a checkbox in a component: <s:CheckBox id=myCB_1 /> In my main.mxml I
O.K. Here's the situation... I have a custom mxml component that contains a couple

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.