Problem adding items to a group after removing everything...

Hello world

I would really appreciate help on something. I have a group that has a few buttons in it. This group is one of the four States, and there is a component for each State. After the user runs the rest of the program and returns to this State, I want to delete the former buttons and add new buttons with new values. Bascially, I want to update the component when it is visited again. I have a problem with adding new buttons to the group when the user revisits the component / state.

The group is created:

          <s:VGroup id="buttons"  x="0" y="35"  height="400" width="280" />

When the function init for this component is called, buttons are added from an array of buttons:

for(var i:int = 0; i < 10; i++){
          var button:Button = questions[i];
          trace(button);
          button.addEventListener(MouseEvent.CLICK, myEventHandler);
          trace(buttons);
          buttons.addElement(button);
}

When the user switches to the next State, the buttons are removed:

if(counter == 4){
          buttons.removeAllElements();
          FlexGlobals.topLevelApplication.currentState = 'Summary';
}

When the user returns to its original state, the buttons are not added to the group as they are the first time. The trace output that each button is added is also different the second time:

For the first time: (successfully)

Main.MainBackground2.contentGroup.gameComp.buttons
button8

Second time:

buttons
button8

Can someone point me in the right direction? And very good question, is there a better way I should do this?

Is there a better way to refresh everything within a component when viewing it s second time?

Thanks in advance!

I don't know why you use addElement() to add buttons. You're not supposed to leave the functionality of the State to manage when the buttons must be visible? This is the way to do it in most cases. You can view a larger code example, where you have boiled down the code in a minimal example that always enhibits the question.

If this post answers your question or assistance, please mark it as such.

Greg Lafrance - Flex 2 and 3 certified ACE

www.ChikaraDev.com

Training Flex and Support Services

Tags: Flex

Similar Questions

  • Added items to randomly change after opening other files in a subfolder.

    I have a file that is pinned on my Start menu that is attached to excel 2007. Now I can quickly open this file in excel when I want.

    The location of this file is \\server\sharedarea\inout.xls

    I have another file I want to pin to pin of excel area. This file is located in a subfolder of the original file.

    The location of this new file is \\server\sharedarea\subfolder\anotherfile.xls

    However when I opened the "anotherfile.xls" my pinned original file "inout.xls" has been replaced by "anotherfile.xls" and anotherfile.xls does not appear in my list of files recently viewed and or not "inout.xls".

    In order to get the "inout.xls" file that is pinned in my pinned items I open it in excel and the pinned "anotherfile.xls" link is automatically crushed and changed in the pinned file 'inout.xls'. For this reason, I am not able to get both "inout.xls" and "anotherfile.xls", pinned to the excel menu area start due to this bug. Not appear in my list of recent files either.

    I also have the same problem with task bar pinned items. If I open a folder or a file that is located in a subfolder of the original pinned item, windows, in his infinite wisdom, will replace my original pinned object, change to the new folder / file I open even if I don't want it (and 99% of the time I don't want it).

    Someone from microsoft can fix pinned bugs points because it is certainly not just me that sees a massive amount of bugs in the added items. It's something I could code and get it right the first time. It would take probably more effort to get Windows to the elements of pinned randomly change he would to leave him alone.

    I'm starting to think that the code of favorite items in Windows 7 needs a serious rewrite. So many bugs for something that really should not have problems, there!

    Thank you for the lack of support on this issue.

  • 8.1 Windows Media Library problems because there are read errors after removing the USB drive

    Whenever I plug a USB key with music on it; It gets automatically added to my library of players. Then when I remove the USB key; I left with a lot of read errors. How can I get my USB drive does not automatically add its contents. I set AutoPlay, even not use. This never happened with Windows 7.i do not know what they changed to do this.

    Hello Chris,

    Thanks for posting your question on the Microsoft community.

    I would like to know some information about the problem so that we can help you better.

    You made any hardware or software changes on your computer before the show?

    Thank you for details on the issue.

    This problem can occur either because of bad parameters of Windows media player.

    I would suggest trying the following methods and check if it helps.

    Method 1:
    Resolution of the problems of Run Windows media player library and check. Please follow these steps:

    a. press Windows + W keys, type Troubleshooting in the search box and press ENTER.
    b. click on 'show all' and then click 'Windows Media Player library'.
    c. click 'Next' and follow the on-screen instructions.

    If this does not help, use method 2.

    Method 2:
    Database rebuild Windows media player and check. Please follow these steps:

    a. press Windows + R key, type %LOCALAPPDATA%\Microsoft in the immediate window and press ENTER.
    b. Select the "Media Player" folder, right-click on it and select delete.
    c. restart Windows media player.

    Note: Windows media player automatically rebuilds the database.

    I hope this information helps.

    Please let us know if you need more help.

    Thank you

  • Problem adding items to wish list

    I use ATG 10.0.3. I am trying to add items to wish list using the following code

    < dsp:form id = 'giftlist' >

    < dsp:input bean = "GiftlistFormHandler.catalogRefIds" type = "hidden" / > "

    < dsp:input bean = "GiftlistFormHandler.giftlistId" type = "hidden"

    beanvalue = "Profile.Wishlist.ID" / > "

    < dsp:input bean = "GiftlistFormHandler.productId" paramvalue = "itemId" / > "

    < dsp:input bean = "GiftlistFormHandler.addItemToGiftlist"

    Type = "submit" value = "Add to wish list" > < / dsp:input >

    < dsp:input bean = "GiftlistFormHandler.addItemToGiftlistSuccessURL"

    Type = "hidden" value="/store/wishlist.jsp" > < / dsp:input >

    < / dsp:form >


    When I submit the form, it accesses the success page. However the articles are not added to the wish list. SiteId and quantity properties were needed? Here are the logs for debugging

    00:23:50, 245 INFO [GiftlistFormHandler] DEBUG error form - stay on the same page.

    00:23:50, 245 DEBUG INFO [GiftlistFormHandler] Validating giftlist ID: gl1390002

    00:23:50, 245 INFO [GiftlistManager] DEBUG inside the getGiftlist: gl1390002

    00:23:50, 245 INFO [GiftlistFormHandler] DEBUG error form - stay on the same page.

    00:23:50, 245 INFO [GiftlistFormHandler] DEBUG error form - stay on the same page.

    00:23:50, 255 INFO [GiftlistFormHandler] not DEBUG any form error - redirect to: /store/wishlist.jsp

    After the property of GiftlistFormHandler.quantity , the elements are added to the wish list. I didn't know that the property is required in the docs. Also debug logs aren't useful.

    Here is the labour code,

         

    value = "sku40003" / >

          

    beanvalue = "Profile.Wishlist.ID" / > "

          

          

    beanvalue="/ATG/multisite/site.ID" / >

          

    value = "1" / >

          

    Type = "submit" value = "Add to wish list" >

          

    Type = "hidden" value="/store/wishlist.jsp" >

    Here are the logs

    14:01:57, 879 INFO [GiftlistFormHandler] DEBUG error form - stay on the same page.

    14:01:57, 879 DEBUG INFO [GiftlistFormHandler] Validating giftlist ID: gl1530002

    14:01:57, 879 INFO [GiftlistManager] DEBUG inside the getGiftlist: gl1530002

    14:01:57, 879 INFO [GiftlistFormHandler] DEBUG error form - stay on the same page.

    14:01:57, 879 INFO [GiftlistManager] DEBUG inside the getGiftlistItemId: giftlist id = gl1530002, skuId = sku40003, productId = prod20001, siteId = basicSite

    14:01:57, 959 INFO [GiftlistManager] DEBUG inside the getGiftlistItems: gl1530002

    14:01:57, 959 INFO [GiftlistManager] DEBUG inside the creatGiftlistItem

    14:01:57, 959 INFO [GiftlistManager] DEBUG inside the addItemToGiftlist: gl1530002, gi10003

    14:01:57, 959 INFO [GiftlistFormHandler] DEBUG error form - stay on the same page.

    14:01:57, 959 INFO [GiftlistFormHandler] not DEBUG any form error - redirect to: /store/security/accounts/wishlist.jsp

    14:01:58, 009 point find DEBUG INFO [GiftlistLookupDroplet]: id = gl1530002; type = gift registry

    14:01:58, 009 DEBUG INFO [GiftlistLookupDroplet] Found point: gift-list: gl1530002

  • Problem adding items downloaded in Microsoft Word.

    Original title: Microsoft Windows.

    I have both Windows 2000 and Microsoft Word that came with my XP. I download articles from two places that relate to the history of blacks. It makes little difference what I download it is a recurring problem. Whenever I bring you Microsoft Word to add to it, is the same thing. I have to go through the entire article and to change the spelling or ignore all every time. Now that my download had reached more than 80 pages it becomes a function very redundant and irritating. Why don't the work remains saved after changing all these glitches? After all, there are only 50,000 words in the provided dictionary and many words are of the older English language. Is there a way to perpetuate my changes?

    I'm sorry that you are in physical distress, but if you provide any information, you will not be able to get any help.

    You has not answered one of my questions.  I'm not a mind reader.  Perhaps, you will find one, if you take the advice of NoMo and ask your question in the Microsoft Word forum.

  • Computer stops after removing the hardware device.

    Original title: closure of the problem

    Once I am done using bluetooth and easy then disable the bluetooth in my laptop sony vaio, my laptop keeps. It is stuck on the "shutting down" screen and stays just like that. In this case only everytym I use the bluetooth.s

    Hello

    Thanks for asking! If I understand correctly, you have a problem with the computer to close after removing the Bluetooth device.

    Before I continue, I would like to collect some personal information.

    1. Were there of the last changes made to the system before the show?
    2. You get the error message?
    3. The question is limited to specific device?

    Method 1:

    Follow the link to perform a clean boot check, if it helps.

    How to perform a clean boot for a problem in Windows Vista or Windows 7

    http://support.Microsoft.com/kb/929135

    Note: Once you are done with the boot, follow step 7 in the link to your computer in normal mode.

    Method 2:

    Follow this update of the driver update Bluetooth drivers. Check if it helps.

    Answer with the results, I would be happy to help you further.

  • Call for ensureIndexIsVisible after adding items to the dataProvider

    Hello

    I have a strange behavior where call ensureIndexIsVisible does not show the correct item.

    Did I miss the correct event to listen to after adding items to the list data provider?

    Description:

    I use spark.components.List with a HorizontalLayout to display my data.

    My data is displayed using the ItemRenderer.

    After the addition of new elements to the dataProvider, I register the Event.RENDER and within this handler, I call ensureIndexIsVisible and cancel the registration to this event.

    Add some data to dataProvider - some elements of thousnd

    list.dataProvider.add (...)

    list.addEventListener (Event.RENDER,

    function renderHandler(e:Event):void

    {

    show index

    list.ensureIndexIsVisible (indexToShow);

    list.removeEventListener (Event.RENDER, renderHandler);

    });

    I made the debug:

    1. If I comment removeEventListener, it will eventually work after some time the event fires.

    2. the original location that I see is a few points behind so if I scroll a bit I can find the desired article

    Thank you

    Roy.

    This blog can be useful: http://flexponential.com/2011/02/13/scrolling-to-the-bottom-of-a-spark-list/

  • Adding items to an enum shifts the constant on the BD...

    A picture is worth a 1000 words, here is my qualm:

    Why adds an element to a constant of the enum addressing the constant of the comic?

    I use a lot this approach for Pseudo-stacked sequences (I use instead a state machine) and I end up spending the enum constant after adding item wach, otherwise, it ends by disappears under what structure it is right...

    Of course, I could just right-click and use the Edit items property (which I've been using today doing my level of tolerance has ebbed down a lot lately), but unless this feature has been voluntarily integrated in LV, it is bordering the sadist.

    Tested in LV 2011.

    Hi guys,.

    Thank you for this comment! I was also able to reproduce here on my computer running LabVIEW 2011 SP1.

    This was reported to R & D (CAR # 339320) for further investigations. Please let us know if you find other problems, we like always your diligence and your comments!

  • I want to download free applications, but it doesn't let me do it cause I have a problem with my payment, I try to remove my debit card and the option did not appear, I can't choose no for the payment, what can I do?

    I want to download free applications, but it doesn't let me do it cause I have a problem with my payment, I try to remove my debit card and the option did not appear, I can't choose no for the payment, what can I do? This happen after I bought some coins for a game

    You must settle the debt until you can download something else of the podcast episodes on the iTunes Store or select None as the payment option.

    (142394)

  • Satellite A55-S1065 - after removing the battery, BIOS ask me password

    So, something happened yesterday, and it seems to me that it is very strange.
    I have a portable Satellite A55-S1065. And while I was with power point, the
    computer crashes. In the midst of my confusion, I decided to delete
    the battery just to make him stop.

    So I did it and plugged it again
    and I tried to turn on the computer. Now, the bios ask me a password,
    but I've no idea what password it is that. Can someone help me solve this problem?
    IM really desperate to find a solution to this since this computer contain
    many of my works.

    Thank you very much.

    > After removing the battery, BIOS ask me password
    I know it may seem silly now, but I never heard of something like that. I use laptop for a long time and I had the experience with many others and strange question, but something like that, never.

    Problem is that we are dealing here in the public forum and BIOS password is a very sensitive area and very important security feature, so we can not write here about some illegal ways how you can remove the BIOS password.

    If there is no way to start your laptop, I recommend you contact the nearest Toshiba service provider and ask for help.
    I'm sorry. :(

  • Hello. There is a problem on the IPhone s 5 - after reset, the display flashes on the sides for 10 minutes, then the flashing stops. And the problem does not appear again until they do not use a Hard Reset (Power Home). The phone is new (5 days). It's a m

    Hello. There is a problem on the IPhone s 5 - after reset, the display flashes on the sides for 10 minutes, then the flashing stops. And the problem does not appear again until they do not use a Hard Reset (Power + Home).

    The phone is new (5 days). It's a wedding?

    If you encounter this flicker, then the next troubleshooting step is to restore from a backup. If the behavior persists after the restore, then the last step is the factory restore. If after the factory restore and adding no additional content, you see always this problem, then you must make an appointment at the Genius Bar to the nearest Apple store or service provider authorized Apple to have the material examined. If the behavior goes after the factory restore, then sync again your content manually, without using the backup. It seems to me it's corrupted content in the backup.

    Restore your device from an iCloud or iTunes backup - Apple Support

    Use iTunes to restore your iPhone, iPad or iPod settings - Apple Support

  • Print spooler problems and cannot install printer driver after Windows 7 upgrade (80070706)

    I just upgraded from Vista to Win 7 Ultimate.  Once installation is complete, I tried to update the drivers and install the latest updates.  Everything worked except for HP LaserJet 4 L driver.  As a first step, whenever the driver tried to install it, the print spooler service may stop working, and the driver installation failed with error code 800F0246.  I then removed everything from the spool directory, rebooted and tried again.  This time, the print spooler service has not prevented from working, but the driver still does not work with error code 80070706.

    I can't find the information for this error (80070706) anywhere on the web.  Any help would be appreciated.

    More information: the HP LaserJet 4 L printer is connected via a parallel to a prolific USB docking cable.  Windows recognizes the printer as the IEEE-1284 device, but says it needs driver to work.

    Update: I was able to manually add the 4L driver using the print server properties dialog box, BUT if I try to add a printer after that, I get "the print processor does not exist.  If I try to add a printer without installing the driver, I get ERROR 0 x 00000002.

    Everything is running as an administrator.  It worked perfectly under Vista.

    Thanks for these links, but these proposals did not help nor solve the problems.

    After a long and painful journey through the registry, I determined that this workstation was already installed 3rd party software, called "Pharos".  Apparently, this software was redirecting the default print processors and was clearly not compatible with Windows 7, although the installation of Win 7 never mentioned a problem of compatibility.  Once this software has been removed, and all the remains erased from the registry, there is now no problems with printers or print spooler.

    In the future, it would be useful that Microsoft has actually provided certain types of useful information when these accidents occur.  Cryptic error numbers and unnecessary event log entries did not provide useful clues.

  • After removing a virus from my computer, I can't access any of my programs like Windows Media Player. Pop - up says choose program to open the file type.

    After removing a virus from my computer last year, I struggle to access most programs such as media player and other things.  When I try to open something, I get a popup asking me to choose the program I want to use to open this file. For some programs, this file is actually listed.  But for the most part, they did not.  For example, Nero express is what I use to copy CDs or DVDs.  I have to go into a safe mode to use it as well as using programs to run virus checks.  I was told that the virus had somehow corrupted or affected my file extensions.  I almost had cheated using powerful PC Max but did some research beforehand.  Any suggestions?

    original title: File Extension problems

    If you need to go to Safe Mode in order to use certain applications (for example, Nero Express), particularly antivirus scans, you most likely have not successfully removed all malware from your computer.

    How did you remove the virus from your computer last year?

    You then install an antivirus application?  Which one?  Are you still using it?  What's his current subscription? Its subscription has already been authorized expiration?

    What version of Windows, including service pack, do you use?

    What other anti-malware software do you currently use?

    Have you analysed recently with the following free tools?  Otherwise, download, install, update and run scans (not simultaneously) with each of them:
    MalwareBytes AntiMalware
    SUPERAntiSpyware
    Like many also restore file associations.

    • Right-click on a file and select open with > choose program.
    • Look in the lists of programs (split in 'Recommend programs' and 'Other programs')
    • If you can't find the application you want to use to open this type of file, click on the button "Browse".
    • The "Program Files" folder should open (if it isn't, go to C:\Program Files
    • Find the program you want to use.  If you are looking in C:\Program Files\------, you determine which file is the actual program.  You should be able to tell from the icon.  If not, see note below)
    • Select the program (the exe file or the name of the program in one of these lists) and check the box "always use the program selected to open this type of file"
    • Click OK
    • Repeat the above for each type of different file according to the needs

    Note: If you need to determine the EXE file for an application, just right-click on the shortcut you use to start the program, and then select Properties.  Click on the tab "shortcut".  The 'Target' box contains the path name to go to the executable (EXE file) for the program.   For example, the executable file for Firefox is "C:\Program Files\Mozilla Firefox\firefox.exe"

    There are a few exceptions, including but not limited to Microsoft applications, which use a more obscure reference to the target.  Word, for example, indicates the 'target' as a 'Microsoft Office' gray of no matter the version.  The real exe for Word is 'C:\Program Files\Microsoft Office\OFFICEnn\WinWord.exe' where the nn refers to the version of Word that you have (Word XP/2002 is 10, Word 2003 is 11, Word 2007 is 12, Word 2010 is 14).

    If you need assistance with a shortcut that does not directly show the name of path, ask.

  • Cannot connect to internet after removing a virus

    Can't connect to internet after removing a virus. Said in the currency manager there is a problem with the ethernet controller and can not find a driver when he found new hardware. Dell optiplex 260 - win xp - IE8

    Hi PamJones. Check if the network in Internet Explorer settings are configured to connect to a Proxy Server and remove the option if there is. To do this:

    1. Launch Internet Explorer (ignore the subject text unable to browse the internet).
    2. Click Tools > choose 'Internet Options '.
    3. Click the Connections tab.
    4. Click the "network settings".
    5. Make sure there's a check mark on the button "automatically detect settings".
    6. REMOVE THE check MARK from the option "use a Proxy Server for your network local (these settings will not apply to the VPN connection or access remotely).»
    7. Click OK to close the LAN settings window.
    8. Click OK to close the Internet Options window.
    9. Close Internet Explorer.
    10. Restart Internet Explorer.
    You are now able to browse websites?
  • missing hal.dll message after removing the hard drive

    Original title:Ok, I had the same problem on my hard drive missing hal.dll. My question is what windows xp writes the cmos on my computer?

    OK, I had the same problem on my hard drive missing hal.dll. My question is what windows xp writes the cmos on my computer? The reason why I ask, is that I physically removed the hard drive from the computer and then start the computer I get the same message hal.dll lack. Since the hard drive is not installed, the only place where this message comes's cmos or bios of the computer.
    I know it seems odd, but I couldn't believe it when I saw it after removing the hard drive. It used to be with older computers and Windows 95 or 98 when you took a hard drive that wasn't working and installed with one that works from a different computer, you could swap out and boot the computer and make a few changes to some drivers if you.

    So what is windows xp write to the memory cmos on my computer?

    > Ok, I had the same problem on my hard drive missing hal.dll.

    The same as what? If you reference another thread, please include a link to it.

    > My question is what windows xp writes the cmos on my computer?

    It is not write anything for her at all.

    > Lack of the reason why I ask this is that I physically removed the hard drive from the computer and then start the computer I get the same message hal.dll.

    I think that you're wrong. I would like to say two things happening:

    1. you have more than one hard drive and the problematic drive was not removed, or

    2. you deleted something other than a hard drive.

    Do you have a CD in your CD drive by chance?

    What is the brand and model of your PC? Are you able to get into the BIOS?

Maybe you are looking for