5 Replies Latest reply on Feb 9, 2010 2:57 PM by rfkrocktk

    PopUpAnchor not acting like an anchor?

    rfkrocktk Level 1

      Is PopUpAnchor supposed to permanently anchor the created popup to the specified x and y of the anchor itself? In my application, I have an anchor aligned to the right side of the screen. When I resize the screen, the popup stays where it was when it was first displayed, rather than being moved with the popup anchor as expected. Is this planned functionality?

        • 1. Re: PopUpAnchor not acting like an anchor?
          Peter deHaan Level 4

          Hhmm, sounds like it may be a bug.

          Can you please file a bug report at http://bugs.adobe.com/flex/ with a simple test case and somebody can take a look.

           

          Thanks,

          Peter

          • 2. Re: PopUpAnchor not acting like an anchor?
            rfkrocktk Level 1

            Ok, just reported it here: https://bugs.adobe.com/jira/browse/SDK-25413

            A compilable demo is available in the bug report if you want to see what I'm

            talking about.

            https://bugs.adobe.com/jira/secure/attachment/54177/popUpAnchorTest.zip

             

            You'll have to be logged in to JIRA for that download to work.

            • 3. Re: PopUpAnchor not acting like an anchor?
              Flex harUI Adobe Employee

              I don't know if PopUpAnchor watches for resize because the recommended UI is

              to dismiss the popup on all mouse activity outside the popup.

              • 4. Re: PopUpAnchor not acting like an anchor?
                Peter deHaan Level 4

                I added the workaround to the bug report, but you can use some clever data binding to force the PopUpAnchor control's contents to follow the Button using the following code:

                 

                <?xml version="1.0" encoding="utf-8"?>
                <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                               xmlns:s="library://ns.adobe.com/flex/spark"
                               xmlns:mx="library://ns.adobe.com/flex/mx"
                               creationComplete="out.play()">
                   
                    <fx:Declarations>
                        <s:Resize id="out" target="{spacer}" widthBy="600" duration="2000"
                                  effectEnd="{iN.play()}"/>
                        <s:Resize id="iN" target="{spacer}" widthBy="-600" duration="2000"
                                  effectEnd="{out.play()}"/>
                    </fx:Declarations>
                   
                    <s:HGroup width="100%">
                        <mx:Spacer id="spacer" width="0%"/>
                        <s:Group id="gr">
                            <mx:Button id="btn" label="Anchor"/>
                            <s:PopUpAnchor id="popupAnchor" popUpWidthMatchesAnchorWidth="true"
                                           left="0" right="0" top="0" bottom="0"
                                           popUpPosition="below" displayPopUp="true">
                                <s:Group height="100" x="{gr.x}">
                                    <s:Rect width="100%" height="100%"
                                            radiusX="5" radiusY="5">
                                        <s:fill>
                                            <s:SolidColor color="#FFFF99"/>
                                        </s:fill>
                                    </s:Rect>
                                    <s:VGroup width="100%" height="100%"
                                              horizontalAlign="center" verticalAlign="middle">
                                        <s:Label text="Popup!"/>
                                    </s:VGroup>
                                </s:Group>
                            </s:PopUpAnchor>
                        </s:Group>
                    </s:HGroup>
                   
                </s:Application>

                 

                Peter

                • 5. Re: PopUpAnchor not acting like an anchor?
                  rfkrocktk Level 1

                  That makes sense, but it would be really helpful to toggle this feature on

                  and off on a per-instance basis and not have to bind data every time I want

                  a moving popup. We could implement a property like

                  "bindPopUpPosition:Boolean" which would allow the user to have the popup

                  bind to the position of the anchor. This would be set to false by default. I

                  would be willing to patch PopUpAnchor to do this if need be.