Anchor a button upper right in a panel?

Have to anchor a button upper right in a panel.  Need it to stay anchored even when I use resize and move effects on the panel.  Want the button up top, not in the panel's content pane.
The only way I know to get a button up there is to put it in the panel's titleBar.  If I want it to be anchored I'll have to put it in a container that supports constraints, like a Canvas, before putting it in the titleBar.  When I do this, constraints seem to go out the window.  They work somewhat but behave abnormally. 
Here's a sample app (2 files) implementing this approach.  Compile and click the button down below.  The large panel with the button in its titleBar is supposed to shrink and hide behind the little video window.  It does, but the button in its titleBar doesn't go along for the ride.  It's not constrained.  Is there another approach to this?
Main app file (constraints.mxml) followed by custom panel file (CustomPanel.mxml)...
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:custom="*"
    layout="absolute"
    initialize="init()">
    <mx:Script>
        <![CDATA[       
            [Bindable]
            private var vidX:Number;
            [Bindable]
            private var vidY:Number;
            [Bindable]
            private var vidW:Number;
            [Bindable]
            private var vidH:Number;
            [Bindable]
            private var panelX:Number;
            [Bindable]
            private var panelY:Number;
            [Bindable]
            private var panelW:Number
            [Bindable]
            private var panelH:Number;
            private var open:Boolean = true;
            public function init():void
                vidX = 20;
                vidY = 20;
                vidW = 180;
                vidH = 120;
                panelX = 202;
                panelY = 20;
                panelW = 500;
                panelH = 350;               
            private function onButtonClick(e:MouseEvent):void
                if(open)
                    inAndDownSize.play();
                    open = false;
                else
                    outAndUpSize.play();
                    open = true;
        ]]>
    </mx:Script>
    <!--  Effects -->
    <mx:Parallel id="outAndUpSize"
        duration="200">
        <mx:Move
            target="{panel}"
            xFrom="{vidX}" xTo="{panelX}"/>
        <mx:Resize
            target="{panel}"
            widthTo="{panelW}" heightTo="{panelH}"/>   
    </mx:Parallel>
    <mx:Parallel id="inAndDownSize">
        <mx:Move
            target="{panel}"
            xFrom="{panelX}" xTo="{vidX}"/>
        <mx:Resize
            target="{panel}"
            widthTo="{vid.width}" heightTo="{vid.height}"/>
    </mx:Parallel>
    <!--UI elements -->
    <custom:CustomPanel id="panel"
        x="{panelX}" y="{panelY}"
        width="{panelW}" height="{panelH}"
        layout="absolute">
    </custom:CustomPanel>   
    <mx:VideoDisplay id="vid"
        x="{vidX}" y="{vidY}"
        width="{vidW}" height="{vidH}"/>
    <mx:Button
        label="Click"
        horizontalCenter="0"
        bottom="10"
        click="onButtonClick(event)"/>
</mx:Application>
CustomPanel.mxml...
<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="absolute"
    initialize="init()"
    creationComplete="onCreationComplete()">   
    <mx:Script>
        <![CDATA[
            import mx.containers.Canvas;
            import mx.controls.Button;       
            private var button:Button = new Button();
            private var canvas:Canvas = new Canvas();
            private var style:CSSStyleDeclaration = new CSSStyleDeclaration();   
            private function onCreationComplete():void
                canvas.width = parent.width;
                canvas.height = parent.height;               
                style.setStyle("left", 400);
                button.id = "button";
                button.label = "b";
                button.width = 30;
                button.height = 30;               
                button.styleDeclaration = style;
                canvas.addChild(button);
                this.titleBar.addChild(canvas);
        ]]>
    </mx:Script>   
</mx:Panel>

Hi,
There is not need to use Canvas to position it. override the updateDisplayList method and move the button. Check the code below.
<mx:Script>
        <![CDATA[
            import mx.controls.Button;
            private var button:Button;
            private var style:CSSStyleDeclaration = new CSSStyleDeclaration();  
               override protected function createChildren():void
                   super.createChildren();
                   button = new Button();
                   button.label = "b";
                button.styleDeclaration = style;
                titleBar.addChild(button);
            override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
                super.updateDisplayList(unscaledWidth,unscaledHeight);
                button.width = 30;
                button.height = 30;
                //move button to the top right
                button.move(width - button.width - 5, 5);
        ]]>
    </mx:Script>

Similar Messages

  • I used to be able to click on the maximise button (upper right corner) and then drag a firefox page from one monitor to another--I can still do this with other browsers but not with Firefox.

    Don't know what else to add in addition to what I say above. I am running Windows 7 Service Pack 1. Also use Windows Internet Explorer, Google Chrome.

    You drag the window by its Title Bar, always been the same for Windows.

  • How set a JDialog to let no close button on upper right?

    How set a JDialog to let no close button on upper right?

    a dialog is like a jframe so when u remove the upper part of it u can add a label like and other component to the frames content pane. u can create a panel which will serve as the upper label and will have a background gradient coloring (like windows frames) and an icon and any buttons u want. its a simple jpanel that u put on the upper side of the dialog. u can add a mouse listener to the panel so when the user pressed the mouse and moves it around u move the dialogs position.

  • HT1386 It says to click the device button in the upper right corner....there isn't one.  Itunes doesn't even recognize my devices since I did the most current update.  I have two iPhones, thru different carriers, and neither one works now!

    I did the latest iTunes update...I have 2 iPhones--each thru a different provider.  Now, I can't sync to download any music from iTunes.  iTunes doesn't recognize either device now.  I went thru diagnostics, didn't work.  I tried the suggestions from Apple...it says to click the device button in upper right corner....there isn't one.  When I connected each for the first time after update, it "installed device drivers".  I have checked for further updates on iTunes--nothing.  I made sure there were no updates listed for iPhones...all up to date.  I get an error code and from what I have looked through in forums etc, it seems like a lot of people are getting it...0ex000084 I believe it was.  Windows opens to download photos but that's it.  Devices are not listed at all.  I have tried all 3 USB ports in computer too.  I have never had any problems before this update!!  HELP!  I just bought $15 worth of music I can't download to phones now!

    On the left hand side of iTunes do you have the sidebar up left hand side?
    If this is not up then try this, with iTunes open press "Control" and "s" together and it should bring it up. From the sidebar it should show an option devices with the iPhones underneath it.

  • Firefox frequently freezes. I can't click on anything (tabs, menu buttons, bookmarks, etc.) The only button that works is the upper right close button which when clicked will ask me if I want to "save & quit." Then I have to restart. Help fixing this?

    Frequently when I use Firefox it will all of a sudden freeze. It no longer will accept any user input from the keyboard or mouse. I cannot click on any of the open tabbed pages I have or on my bookmarks or any of the menu buttons. Nothing works. When it happens if it is loading a page it will just freeze in the middle of loading it. I've tried to see if the freezes are caused when it loads certain types of content (java, flash, etc...) but there seems to be no rhyme or reason as to when it happens or with what types of pages. I cannot find a pattern. The ONLY button that works is the close button in the upper right hand corner (X). I can click on that and then Firefox will prompt me with it's regular message asking me if I want to save and quit, quit, or cancel. I'll hit save and quit and then reopen Firefox. It opens my tabs and if I was in the middle of a post it generally will still remember the text I've typed (except Facebook!).
    It's beginning to drive me nuts and I'm really hoping to find a fix to this.

    You will also notice that your shift key will be emulated. Meaning that keys you will try to press will press but they will act like you are pressing the shift key when you are doing them.
    Try this, minimize the firefox window by pressing the tab on your taskbar. After doing that maximize it again. You will magically be able to click any link on your page. When you navigate to a new page however, the entire situation will start all over. My only remedy is rebooting and hoping it doesn't happen again soon.

  • Drop down button is no longer located in the upper right corner of browser

    Using Firefox 5.01
    For some reason, my bookmark button is longer behaving as a dropdown box in the upper right corner of the browser?
    The box is there, but when clicked, my bookmarks appear on the left side of the screen.
    I used to be able to click the bookmark box, the bookmarks appear and drop down, select a bookmark and the bookmark menu closes.

    That does explain the X. Thanks!
    The reason I'm exporting in the first place is that a friend of mine wants me to fiddle with the rough cut of his video project a bit, and burn the results back onto DVD. (I think he thinks I can do more than I actually know how to at this point, but I figure that playing around with it is a good way to familiarize myself with the application.)

  • Download list button in upper right corner hinds under "Reader" button? Unable to find down loaded file in the download folder afterward?

    The Download list button in upper right corner of screen hides under "Reader" button?   Does not show down loaded(?) file in the download folder afterward?
    Trying to run a brokerage firm streaming quote app with java.  Wondering if I may have deactivated the Download list button some how?

    Hey Sgt.Rics,
    It sounds like you're experiencing some unexpected behavior in Safari, specifically the window layout blocking the Downloads button. I would check and make sure no third-party add-ons are causing the issue:
    Safari: Unsupported third-party add-ons may cause Safari to unexpectedly quit or have performance issues
    http://support.apple.com/kb/TS3230
    Welcome to Apple Support Communities!
    Take care,
    Delgadoh

  • Upper right corner radio buttons disappear

    Whenever I upgrade Firefox from version 32, the radio buttons in far upper right corner for "minimize, change window size, and close", disappear. They'll appear momentarily, and then they're gone. If I downgrade back to version 32, I get them back, so I've been keeping version 32 just for this reason. Was wondering why they're disappearing in version 33!
    Thanks

    Are you using an installed theme, or the default?
    '''[https://support.mozilla.org/en-US/kb/troubleshoot-firefox-issues-using-safe-mode Start Firefox in Safe Mode]''' {web link}
    While you are in safe mode;
    Type '''about:preferences'''<Enter> in the address bar
    Select '''Advanced > General.'''
    Look for and turn off '''Use Hardware Acceleration'''.
    Poke around safe web sites. Are there any problems?
    Then restart.

  • TS4204 I need to delete a calendar event that transfered to my 4S from my Droid.  Also this event occurs yearly.  When I open this event, the edit button in the upper right corner does not exist so I can't delete it.  Any suggestions to get rid of it? Sur

    I need to delete a calendar event that transfered to my 4S from my Droid phone. This event occurs yearly.  When I open this event, the edit button that normally appears in the upper right corner does not exist so I can't delete it.  Any suggestions on how to get rid of it?

    uninstalled firefox ....deleted all files still remaining under mozilla firefox directory in program files ... to avoid having to reprogram all my settings, reisntall all addons as well .. I did not remove anything from mozilla firefox that is stored in either appdata or under the windows users directory (if any)
    ... the as suggested reinstalled the latest version of the firefox browser using the link you provided in the email ..; tested and several issues still remain present and unresolved ....
    so please this is urgent or I will have to jump browsers and start using chrome .. because we work 14 hours a day 6 (sometimes 7) days a week, to get ready for the launch of our newest venture and we cannot lose that much days on browser related issues ... so please instead of putting me through week long step process .. of do this .. do that .. can you please actually look into the issue from your end .. I use firefox for so many, many years thta I deserve this kind of support .. thnx Robert

  • What is the fourth control button in the upper right corner of the FF 4 window?

    I had to reinstall FF4 during a virus cleaning process, and there are now 4 control buttons displayed in the upper right corner of the window. From the right, there's the usual "Close" (red), "Restore down" and "Minimize" buttons (both blue), and then there's a fourth, green button, with no "ToolTip" associated with it. What's the behavior of this new button?
    I'm not normally this curious, but I've just had a battle with the "Antivirus Antispam 2011" malware, and am very sensitive to new graphics that I don't recognize.
    I'm running XP Pro.
    Thanks!

    I've found over the past day that its presence comes and goes, presumably based on background apps.
    As I'm unable to predict when I'll catch it next time, it's best I close this question and I'll reopen a new question when I can provide a screenshot.
    Many thanks for your response, and I'll watch for its reappearance.
    John

  • I updated Firefox and now Realplayer can't download any videos( download button in upper right corner of video don't pop up and there is no download option if I right click) if I use Internet explorer it works fine, I also went in to make sure I had it ch

    I updated Firefox and now Realplayer can't download any videos( download button in upper right corner of video don't pop up and there is no download option if I right click) if I use Internet explorer it works fine, I also went in to make sure I had it checked to pop up it is?! So it's not just youtube for me its all videos!
    == This happened ==
    Every time Firefox opened
    == the last firefox update
    ''locking due to the age of this thread''

    haven't tried it myself but saw this earlier in a blog somewhere:
    "try retro installing FF v3.6.3",
    makes sense 'cos I've only been experiencing the same problem with mozilla & realplayer combo since updating to latest FF v3.6.4
    noted that under IE realplayer plugin still works fine, button to 'download this video' comes on as before.....
    from what I read retro install will pick up all your bookmarks etc. do no worries there
    naughty, NAUGHTY mozilla people! you were 'bombproof' until today....what happened? good luck sorting it out though!!!! I still luv you!

  • Randomly i won't be able to use the exit or maximize/minimize buttons in the upper right hand corner. Anyone know what to do?

    the minimize, maximize, and exit buttons in the upper right hand corner randomly stop working. i have tried to restart firefox in safe-mode and it still happens. I have also tried reinstalling firefox and that did not work either. anyone know a solution?

    Hi,
    If the problem occurs in more than one application it could be a system graphics setting, problem or similar. You can try to check by opening another application in the same position and using it for some time.
    You can also try Firefox in a [https://support.mozilla.org/en-US/kb/Managing-profiles new profile] for some time, and later also deselect '''Use hardware acceleration when available''' in '''Tools''' ('''Alt''' + '''T''') > '''Options''' > '''Advanced''' [https://support.mozilla.org/en-US/kb/Options%20window%20-%20Advanced%20panel?as=u General], restart in the new profile and check again.
    [https://support.mozilla.org/en-US/kb/Options%20window Options]

  • Unable to view Device button in the upper-right corner

    When I connect my iphone to my laptop to sync the data from Itunes I am not able to view the Device button in the upper right corner of iTunes. Can you please help as to how to go about this.

    Sunzeus wrote:
    ..where the back up button should appear is empty for me...
    If there is No backup available... Set up as a New Device and Sync your Data/Information to the Device after the successful Restore.
    However... if your Device has been Modified... you are on your own.
    Unauthorized modification of iOS
    http://support.apple.com/kb/HT3743

  • Facebook(wall post) location button not working in mountain lion macbook pro 13inch in upper right button

    facebook(wall post) location button not working in mountain lion macbook pro 13inch in upper right button

    No third party applications installed; no gestures changed. It just starts acting up like I described a few times a day. I'll be browsing the internet and go to switch desktops and it suddenly doesn't work.

  • Remove the close button in upper right corner

    How do I remove the close button in the upper right corner?

    I'm trying to do the same thing. I discovered that it's not a Java limitation, but a look-and-feel limitation. You can use JFrame.setUndecorated(true) and JFrame.getRootPane().setWindowDecorationStyle(some_style_without_close_button), but this will only work if the current windowing system supports disabling native decorations (MS Windows does), and if the current look-and-feel supports window decorations. A quick test (in J2SE 1.4.2) shows that:
    Metal LAF -- supports
    Motif LAF -- does not support
    Windows LAF -- does not support
    Anyway this is not sufficient for me since I need to use the native look and feel on all systems.

Maybe you are looking for

  • Hoiw do I force my new mf8580cdw to print in black and white only (grey scale)?

    First of all I am using windows 7 - 64bit and my printer is the MF8580CDW. I am using the UFRII print driver. I have tried changing one/all of the profiles in the print settings and printer properties to "black and white" printing but the software ke

  • Firefox will not load my swf file. Runs perfectly in all other browsers. Help!

    I've developed a website (www.fit-mamas.com.au) whereby you click on the black & white image and get a pop-up window running a video. The video is an .flv file running via a .swf file loaded from an html file. The .swf file was produced using Flash C

  • Problem while installing CS6, Please Help

    Hello everyone, I almost search every help available around the internet for my problem and can't figure that out. Hope you guys might had better knowledge about that. I am facing a problem while installing Photoshop CS6 version and I already deleted

  • HV segmentation based on relationships

    Hi, We have a requirement of extracting contact of BPs in segmentation while applying marketing attribute filters on BPs. How can this be done using HV segmentation, since there is no option of using a function module. We are using CRM 7.0 EHP1. Than

  • Debug console

    I am having trouble with my iphone the internet 'safari' connection is extremely slow and I keep recieving error messages and messages to debug console. any suggestions