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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:18:42+00:00 2026-06-10T13:18:42+00:00

flex 4.6 I am using addElement as below. I note however that when inspecting

  • 0

flex 4.6

I am using addElement as below. I note however that when inspecting the element, the name of the element is suffixed with a number, so the loaded element name of newMod becomes newMod10 (number is variable). If I want to then removeElement() I have no idea of what the correct getChildByName() would be, so getChildByName("newMod") fails.

So my Q’s are

  1. how do i addElement() with a unique name
  2. how do find the name of the element I just added so I can reference by the nameXX

thx
Art

/*  load module */
/*   creationComplete="loadNewMod('modToLoad','A' )
public function loadNewMod(modName,evtTyp):void {
   info = ModuleManager.getModule(modName);
   var self:Object = this;
   var meh =  "modEventHandler"+(evtTyp);
       info.addEventListener(ModuleEvent.READY, function(e:ModuleEvent){
        self[meh](e)
            });
   info.load(null, null, null, moduleFactory);
   }

private function modEventHandlerA(e:ModuleEvent):void {
   vg1.addElement(info.factory.create() as IVisualElement);
  }


<s:Group id="vg1" horizontalCenter="0" verticalCenter="0">
    <s:Label id="newLabel" />
</s:Group>

[EDIT]
by breaking out the function I have added an ID that seems to work

private function modEventHandlerA(e:ModuleEvent,fcall):void {
   var newID = info.factory.create();
   newID.name = "myElem";
   vg1.addElement(hh as IVisualElement);
   }
  • 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-06-10T13:18:44+00:00Added an answer on June 10, 2026 at 1:18 pm

    Best way is likely to attach a name property to the object and do a for loop. It’s inefficient, but the ID label doesn’t seem to work properly when setting it in AS3.

    info.name = "info1";
    
    
    for ( var i:Number = 0; i < vg1.numElements; i++ ) {
         if ( ( vg1.getElementAt(i) as UIComponent).name == "info1" ) {
             vg1.removeElementAt(i);
             break;
         }
    }
    

    I didn’t check to see if info would have the name property, but that would do the trick. Alternatively, you could use the exact same method with the id tag, except use indexOf(“info1”) >= 0, instead of .name == “info1”

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

Sidebar

Related Questions

I'm using flex (lexical analyzer, not Adobe Flex) on a project. However, I want
problem : Line in flex using mxml that doesn't appear to be straight!? <s:Line
I'm using Flex 3 with Flash 9. I'm trying to make a timer that
How to retain two decimal points in flex using Math.Round code: txtTotal.text=Math.round((Number(txtRate.text)*Number(txtQuantity.text))).toString(); here the
I'm using Flex to generate text that will be copied to the clipboard so
I am using Flex Builder 3 to develop my first application that will communicate
I'm using Flex and am trying to access a Web Service. That web service
Im trying to create a layout in flex using mxml, the layout contains a
I've created a linechart in flex using pure as3. I need now to convert
Using Flex 3, I would like to take an image snapshot such as this:

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.