Search the web
Sign In
New User? Sign Up
flexcoders · RIA Development with Adobe Flex
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
PopUpButton issue   Message List  
Reply | Forward Message #99105 of 150922 |
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





Wed Jan 16, 2008 1:37 pm

smelbyfastlane
Offline Offline
Send Email Send Email

Forward
Message #99105 of 150922 |
Expand Messages Author Sort by Date

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...
Scott Melby
smelbyfastlane
Offline Send Email
Jan 16, 2008
1:37 pm

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...
Deepa Subramaniam
deepasubra
Offline Send Email
Jan 16, 2008
8:19 pm

Deepa - Thanks! It seems you could avoid the memory leak without nulling _popUp couldn't you? i.e. just call PopUpManager.removePopUp(_popUp) without the...
Scott Melby
smelbyfastlane
Offline Send Email
Jan 16, 2008
8:46 pm

There were intricacies with the PopUpManager logic which, I think, led to this solution. The framework changelist (available on labs) would have more details. ...
Deepa Subramaniam
deepasubra
Offline Send Email
Jan 16, 2008
10:57 pm

I'm having exactly the same problem - it's as if the PopupButton is suffering from Alzheimer. Scotts solution works great and I also think that not resetting...
vdeprojects
Offline Send Email
Jan 29, 2008
2:01 pm

I agree - nulling the _popUp property seems like a hack. There doesn't seem to be a logical link between removing a PopUpButton from the stage and nulling its...
dazweeja
Offline Send Email
Feb 6, 2008
5:40 am

I have now :) http://bugs.adobe.com/jira/browse/SDK-14562 Scott Scott Melby Founder, Fast Lane Software LLC http://www.fastlanesw.com...
Scott Melby
smelbyfastlane
Offline Send Email
Feb 6, 2008
1:38 pm

Scott, There seems to be a variety of cirumstances where the behavior can be seen. Here's a bug entry for the item already: ...
Battershall, Jeff
jeff_batters...
Offline Send Email
Feb 6, 2008
2:57 pm

Jeff - I saw the bug you referenced in JIRA when i searched, but I decided to add my bug report anyway because that existing one was marked as "closed". Scott ...
Scott Melby
smelbyfastlane
Offline Send Email
Feb 6, 2008
4:24 pm

Scott, Gotcha. Don't know how it could be considered to be closed when the only thing we've got is a hack to work around it. But be that as it may, I would...
Battershall, Jeff
jeff_batters...
Offline Send Email
Feb 6, 2008
4:29 pm

The original bug is Deferred and Closed. This doesn't mean it won't be fixed, however. It is deferred for this release of Flex 3 (which is coming to an end),...
Joan Lafferty
joan_lynn
Offline Send Email
Feb 6, 2008
10:05 pm

Joann, I understand the constraints of time, release dates and such. It is a real pain, though, that a component that is pretty darn useful needs a hack-y...
Battershall, Jeff
jeff_batters...
Offline Send Email
Feb 6, 2008
10:32 pm

Doing it on "addedToStage" event somehow doesn't work well for my app. My app kept on crashing due to a null popUp. Instead of doing it on "addedToStage", I...
handitan
Offline Send Email
Apr 16, 2008
5:57 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help