Because the popup is in a control in the viewstack this would mean walking up to the parent. For now the best work around I have found is

 

actionMenu.includeInLayout = false;
tools.addChild(actionMenu);

 

Based on my example. If the menu being popped up is a child of the container contained in the stack all works well.

 

I think that the pupup menu needs to be a child of it's parent.

 

I'll try your tip out as well, but adding a child seems logical as you may want to access it anyway via other means.

 

jason

 
-----Message d'origine-----
De : [email protected] [mailto:[EMAIL PROTECTED]De la part de sinatosk
Envoyé : vendredi 31 mars 2006 21:11
À : [email protected]
Objet : Re: [flexcoders] Bug : Popupbar when in viewstack [Flex 2.0 b2]

Yeah I had this problem since Beta 1. I thought people would have figured to just move something on their screen and put it back in place
 
in your case... increase the height of the view stack by +1 and then decrease it by ( -1 ) and should force it to refresh the whole view stack
 
keep in mind though... it will only get rid of the part that the menu is on
 
WARNING: this may not work for everybody or may not work well sometimes either

 
On 3/29/06, sourcecoderia <[EMAIL PROTECTED]> wrote:

So there seems to be a bug in the view stack not redrawing it's children, or a bug in the popupbutton.

 

The dropdown menu is not being cleared. The only way to avoid it is to add the menu as a child to the popupbuttons parent container and don't include it in the layout.

 

See below code. Run it an click the popupbutton to see the effect. Then uncomment the addchild and include in layout code and run again to see the temp solution.

 

This is not view stack container specific i.e. same problem on Vbox, Hbox, Controlbar, ApplicationControlbar, Box, Canvas etc..

 

On the other hand it may very well be the only way to do it. If this is true update the documentation to specify so.

 

Code test:

 

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns="*" layout="absolute">

<mx:Script>
 <![CDATA[
   import mx.controls.Menu;
   import mx.events.MenuEvent;
   private var actionMenu:Menu;

            private function initMenu():void {
                actionMenu = new Menu();
               
                //actionMenu.includeInLayout = false;
                //tools.addChild(actionMenu);
               
              
                var actionMenuDS:Object = [{label: "Complete selected"}, {label: "Delete selected"}, {label: "Export list"}];       
                actionMenu.width = actionList.width;
               
                actionMenu.dataProvider = actionMenuDS;
                actionMenu.addEventListener("change", handleChange);
                actionList.popUp = actionMenu;
               
            }

            //Execute the action reqested and update the control display
            private function handleChange(event:MenuEvent):void {
                actionList.label = event.menuItem.label ;
                actionList.close();
               
            }
     
  
 ]]>
</mx:Script>

<mx:ViewStack height="100%" id="Cont" width="100%">
 <mx:Canvas id="tools" width="100%" height="34" borderStyle="solid"  backgroundColor="#c0c0c0">
  <mx:PopUpButton textAlign="left" id="actionList" cornerRadius="0"  label="Actions" width="155" creationComplete="initMenu();"/>
 </mx:Canvas>
</mx:ViewStack> 

</mx:Application>

 

Any thoughts ??

 

Jason

 

 



--
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






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to