This chunk of code was added on purpose, to avoid problematic memory leaks with popup components. In Jira you can see it was fixed to address SDK bug 13104. We were not correctly unregistering popup children when necessary. Your workaround is correct, so feel safe using it :)
https://bugs.adobe.com/jira/browse/SDK-13104 -----Original Message----- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Scott Melby Sent: Wednesday, January 16, 2008 5:38 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] PopUpButton issue I have a PopUpButton on which I am setting a Menu as the popUp property. I have found that the popUp attribute is being nulled when the PopUpButton is removed from the stage... which causes my button to not function properly when added back to the stage. I traced the issue to the following code in PopUpButton.as which appears to be incorrect. In this code the _popUp member (backing for the popUp setters and getters) is nulled. private function removedFromStageHandler(event:Event):void { // Ensure we've unregistered ourselves from PopupManager, else // we'll be leaked. if (_popUp) { PopUpManager.removePopUp(_popUp); _popUp = null; } } To workaround this issue I had to listen for the addedToStage event in my view that uses this component and re-set the popUp property each time as follows. /** * Called each time this view is added to the stage. We need this to work * around an issue where the PopUpButton has a null popUp * property each time it has been removed from the stage. */ public function handleAddedToStage():void{ if(this.createButton != null && this._buttonMenu != null){ this.createButton.popUp = _buttonMenu; } } Has anybody else seen this? Can somebody please let me know if this is a bug in the toolkit? The workaround works fine... but seems like it should not be necessary. Thanks Scott -- Scott Melby Founder, Fast Lane Software LLC http://www.fastlanesw.com -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links