TitleWindow PopUp Can Be Dragged Off Stage!

I am making a popup window using a custom TitleWindow component which is opened by clicking a "Settings" button using the following method:
private var titleWindow:TitleWindow;
private function popUp():void {
    titleWindow = PopUpManager.createPopUp(this, CustomTitleWindow, true) as TitleWindow;
    PopUpManager.centerPopUp(titleWindow);
Everything is working fine, however, I am able to drag it completely outside the stage!  If the user releases the mouse while the window is off the stage, then there is no way to find/grab it again and bring it back on the stage!  Of course, this situation is not too acceptable for customers.  Is there any way that I can limit the popup window to the boundaries of the stage?
Also, if the user clicks the "Settings" button multiple times, multiple popup windows will be opened!  I don`t want to make the popup window modal.  Is there any way to limit instances of the popup window to one?
Thank you in advance for any help anyone can give!
Matt

Hi Matt,
Here's a solution for bounding the moves of a TitleWindow:
<?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" >
    <fx:Script>
        <![CDATA[
            import mx.managers.PopUpManager;
            import spark.components.TitleWindow;
            import spark.events.TitleWindowBoundsEvent;
            private var titleWindow:TitleWindow;
            private function popUp():void
                titleWindow = PopUpManager.createPopUp(this, TitleWindow, true) as TitleWindow;
                PopUpManager.centerPopUp(titleWindow);
                titleWindow.addEventListener(TitleWindowBoundsEvent.WINDOW_MOVING,
                                             titlewindow1_windowMovingHandler);
            protected function titlewindow1_windowMovingHandler(event:TitleWindowBoundsEvent):void
                // These are the new bounds when the window is moved.
                // You can modify them to alter the result of when the TitleWindow moves.
                var endBounds:Rectangle = event.afterBounds;
                // left edge of the stage
                if (endBounds.x < 0)
                    endBounds.x = 0;
                // right edge of the stage
                if ((endBounds.x + endBounds.width) > this.width)
                    endBounds.x = this.width - endBounds.width;
                // top edge of the stage
                if (endBounds.y < 0)
                    endBounds.y = 0;
                // bottom edge of the stage
                if ((endBounds.y + endBounds.height) > this.height)
                    endBounds.y = this.height - endBounds.height;
        ]]>
    </fx:Script>
    <s:Button click="popUp()" />
</s:Application>
Basically, I add an event listener for the "windowMove" event on the TitleWindow and limit where it can move around in the application. You can see the ASDoc for TitleWindowBoundsEvent for more information. Hope this helps!
-Kevin

Similar Messages

  • How far off stage can I move a tweened object

    Flash Pro CC 2014, all updates.
    I have a movie clip that is about 5500 pixels wide. I need to have it enter and exit across a 1920 x 1080 stage. As I try to move it to the left, it won't let me motion tween it far enough to get it off stage. It reaches the point where the left side of the object is at -3780 and that's the limit. I can drag it farther but when I release it the movie clip snaps right back to this distance.
    Also, I need to activate roving frames so the motion is smooth, but for some reason I don't get the option, it's grayed out in the menu. Don't know if this relates to problem #1 or if I am just doing something wrong.
    This one is a hot potato, as usual, I have someone hyperventilating to get this back to them.
    Thanks for any help!

    Except that it still won't work. That's one of the first things I tried.
    If I position the mc at x = 1980 so it's left edge is just off stage, then motion tween the span, then go to the last frame of the span, I enter -5478 into the x value in the properties panel and it turns it back to -3779 when I change focus just like when I drag it. It's like there's a limit on how far it will let me go.
    If the mc is not in a tween I can slide it left forever (thank you unlimited pasteboard), but in a tween it refuses to go past x = -3789. Is there a tween limit somewhere? It won't go more than 7740 to the right either, just snaps right back when you release it or change focus in the properties panel.

  • How can I turn off Popup blocker to allow me to print boarding passes from Easyjet ?

    How can I turn off Popup blocker to allow me to print boarding passes from Easyjet website ?

    This helped greatly. However, some sites like banks now insist I use Chrome.  How do I turn off pop ups in Chrome on my iPad ?

  • How can i drag videos off of my iPhone 5 onto my MacBook Pro?

    how can i drag videos off of my iPhone 5 onto my MacBook Pro?

    you'll need to import them
    try using iPhoto, if you don't have iPhoto then you can use image capture. If you can't find image capture type it into the finder.

  • Dragging the stage newbie question part 2

    Hi guys. I posted a thread on 16th November http://forums.adobe.com/thread/525138 and have created an animation (see attached) where the stage can be dragged from left to right to reveal hidden areas off the edge of the stage. Unfortunately I need to add buttons containing links to websites within the dragable movie symbol and I can't work out how to do it. Any ideas?

    Stealing the code from the old thread, for ease-of-use, here is what you will need to do.  Like the alert button that tells people what to do, you need to add the other links/buttons separately from the draggable clip, and move them with it.  This is fairly simple to do.
    mc_portletlist.onPress = function()
         btn_popup._visible = false;
    btn_popup.onPress = function()
         btn_popup._visible = false;
    mc_portletlist.onMouseDown = function() {
         mc_portletlist.startDrag(false,462,35,462,737);
         mc_portletlist.onEnterFrame = function(){
              buttonToMove._x = mc_portletlist._x;
              buttonToMove._y = mc_portletlist._y;
              updateAfterEvent();
    mc_portletlist.onMouseUp = function() {
         mc_portletlist.stopDrag(false);
         mc_portletlist.onEnterFrame = null;
    You will need to play with this a bit, as you want the buttonToMove to move with the draggable clip, you will need to add/subtract from the mc_portletlist x and y as appropriate.  If you want to have multiple items, I would place them all in a MovieClip, make sure its on a layer above mc_portletlist, and have that one item move.
    See the attached zip for a working example SWF and Flash CS3 FLA

  • Can't drag n drop songs.  Can't reorder playlists.

    I can no longer drag n drop songs into playlists, nor can I reorder my playlists.  I've checked forums online and the common solutions are:
    1. make sure your playlists or not smart playlists.  
    and
    2. click the numbers column and make sure shuffle is off.
    The playlists I'm trying to affect are definitely not smart playlists.  And, Shuffle is definitely off.  I've tried everything I can think of.  I cannot drag songs to reorder a playlist. And I cannot even drag a song from my library into a playlist.  I have to right click the song, and then click Add to Playlist and Choose the Playlist from the popup menu,  which is very frustrating, especially considering I've had iTunes for years and could always drag n drop and reorder.  What happened?  Please help.

    I'm having the exact same issue on my iMac after updating to 10.5. The first issue was getting the message "iTunes Library.itl cannot be read because it was created by a newer version of iTunes. I googled the solution below and it got my library back.
    ====
    "Go to C:\Users\(your username)\Music\iTunes and rename the file iTunes Library.itl to iTunes Library.OLD
    ..... then Open iTunes, go to "Help" --> "Check For Updates". Once you update iTunes, go back to "C:\Users\(your username)\Music\iTunes" rename newly created "iTunes Library.itl" to "iTunes Library.NEW" and your old file, "iTunes Library.OLD" rename back to "iTunes Library.itl". You will be able to open your iTunes and all Libraries with in."
    ====
    I thought I was in the clear until I tried making a new playlist today. Discovered that I can't drag and drop songs anymore. Have to right click on each song individually to Add to Playlist. Ugh! Any help would be greatly appreciated.

  • Dragging the stage newbie question

    I'm using Flash CS3 and wish to create a movie where the stage is a certain size but the actual content of the movie extends further than the stage. The user will be able to drag the stage from left to right to show hidden parts of the movie. Similar to the idea of a horizontal scrolling image gallery but without the scrollbar (see attached for example image). Does anyone know how this is done or where I can find a tutorial explaining how to do it?
    Cheers

    I have done this type of interaction (AS2), not left to right, but up and down, so you will have to make some adjustments.
    I placed the large image on the stage converted it to a movieclip and gave it an instance name of mc_portletlist.
    I then created a mask for the area I wanted the image to be visible.
    This is optional, but I created a popup that tells the user what to do (btn_popup).
    I then placed the code below on the actions layer.
    The numbers limit the movement of the image, so if you want the user to be able to move the image around without limits, just remove them.
        mc_portletlist.onPress = function()
    btn_popup._visible = false;
        btn_popup.onPress = function()
    btn_popup._visible = false;
    mc_portletlist.onMouseDown = function() {
    mc_portletlist.startDrag(false,462,35,462,737);
    mc_portletlist.onMouseUp = function() {
    mc_portletlist.stopDrag(false);

  • Can not drag anything in finder to desktop, itunes, ect.?

    While the finder window is open I continue to try and drag any of the icons in there to either my desktop or my itunes. I am trying to move some music I have in my finder on to my itunes library and I can not drag or even move any of the icons for some odd reason. Any help with this? Thanks

    I had a similar problem but worse in that I couldn't drag anything anywhere in Safari 5.1.2. Even drag in the "Customize Toolbar" dialog did not work.
    I switched off extensions, quite Safari and restared. The problem cleared and has remained clear after several launches of Safari.
    I only had ClickToFlash and ClickToDevonThink installed.

  • Can't drag songs into playlists or move in playlists easily

    I have upgraded to Lion and the latest iTunes and now I am finding it VERY hard to move tracks in the program. For example, dragging a track from the library into an existing playlist is **** near impossible. And when I FINALLY get it in there it is ABSOLUTELY near impossible to move it’s position up or down on the playlist. What gives? Any ideas?

    Before anyone suggests the following I have tried this already:
    •restarted itunes
    •restarted mac
    •made sure shuffle is turned off
    •made sure the playlist order is selected
    Also, it is NOT a smart playlist. I know you can’t drag tracks into smart playlists.
    Thanks in advance!

  • How can I turn off the 2 blue lines running vertically in my image in Photoshop?

    How can I turn off the 2 blue lines running vertically through my image in Photoshop? I want to save my work but do not know if these lines will persist in the saved image.

    normfb wrote:
    I assume the Rulers are showing. In that case, to get rid of each line use the Move tool to straddle the line and drag it whence it came. I really didn't need to add this comment but it is the first time in years I have had a chance to use the word "whence".
    Is this a guide I see before me? Doeth it conspire to confuseth mine eyes with sapphire lines that afoul my worthy parchment, and draw my quill from its righteous path? Be gone foul guide from whence thou cometh.  Verily, forsooth, and hey nonny nonny.

  • Any time I open Safari i get a popup for myvdrive? why and how do I stop this? yes my safari preferences are checked that popups should be turned off.

    why and how do I stop this? yes my safari preferences are checked that popups should be turned off. Also it pops up any time that I click anywhere to do anything in safari. Please help.

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of the test is to determine whether the problem is caused by third-party software that loads automatically at startup or login, by a peripheral device, by a font conflict, or by corruption of the file system or of certain system caches.
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards, if applicable. Start up in safe mode and log in to the account with the problem. You must hold down the shift key twice: once when you boot, and again when you log in.
    Note: If FileVault is enabled, or if a firmware password is set, or if the boot volume is a Fusion Drive or a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to boot and run than normal, with limited graphics performance, and some things won’t work at all, including sound output and Wi-Fi on certain models. The next normal boot may also be somewhat slow.
    The login screen appears even if you usually login automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    Test while in safe mode. Same problem?
    After testing, reboot as usual (not in safe mode) and verify that you still have the problem. Post the results of the test.

  • Can't drag and drop or copy multiple photos from iPhoto 9.4.2

    I am trying to export multiple edited (not originals) photo files from iPhoto to finder (actually to place in my Dropbox folder to share with friends/family). This used to be (in previous versions of iPhoto?) an easy case of dragging and dropping a selection of photos, or even a whole event, to the desired location in Finder. However, this no longer seems to work. It seems like it will as when you select and drag the photos, the 'green plus' symbol appears and remains when I move to drop the selection into finder, but then nothing happens. The photos dont transfer.  
    I can still drag and drop a SINGLE photo effectively and it saves in the edited form. I also tried selecting the desired photos, chosing copy and then paste in the desired location in finder. But when I chose 'paste' (right click, paste; or edit, paste) in the desired location, it only pastes a limited selection of the photos which I chose to copy. Not all the photos copy across.
    I cant understand why this is no longer possible as it used to be one of the classic examples of intuitive file actions that I love Apple for. The only way I can find now is to chose to export the selection or event (file, export) but this is much less easy and requires various decisions about the file quality etc. Using this option with various compression options, I have not been able to replicated the "original" file size which is displayed under 'info' for each photo in iPhoto.
    Any ideas please?
    Tom

    Thanks LarryHN thats helpful. I've just tried that and the export 'current' option does indeed re-create the edited photo file with exactly the same file size at that shown in iPhoto. I did consider the 'current' option but was put off by the loss of the metadata with this option. But maybe the old drag and drop approach was the same?
    It's curious that the resulting file size from 'export, current' is different (larger in the example I just tried) in comparison to that resulting from 'export, jpeg' (with either the medium or high option selected).
    OK there seems to be a couple of reasonable options available although neither is as nice as the simple 'drag and drop' which used to be available!!! Why would they remove that option?? (and yet not for single files?).
    Thanks
    Tom

  • Can't drag-and-drop into applications folder

    Just got a new iMac last week, my old ibook finally died. I'm trying to install firefox in the imac and i can't. It downloads fine, I can open up the .dmg file, but then I can't drag the icon into the applications folder. I can drag it, but nothing happens when I try to drop it. I've tried using the alias folder, the folder on the dock, just doing it in the finder window, nothing works! tried re-downloading, everything i can think of. Since it is a new machine, do i have something in preferences set wrong? Help!!!

    Do you have "allow user to administer this computer" checked off in your account in System Preferences -> Accounts ?
    Also, right click on your Applications folder, and hit "Get Info" Make sure that the group that owns it is "admin" and "admin" has read and write privileges. If it's admin, but it says "read only" click on the lock, put in your password, and flip up the group privs and change it to read and write.
    If the group is NOT admin on the Get Info screen, you will need to launch /Applications/Terminal.app and issue this command:
    chgrp admin /Applications

  • Can't drag and drop into Preview's sidebar

    Most of the time that I try to drag and drop image into Preview's sidebar (OS10.5.2), it doesn't work -- no cursor, no nothin'. Strangely enough, I can open one or more of the very same images using "open" in the menu, but I can't drag them from one Preview sidebar to another or drag more images in. Even more strangely, some images (very few) DO work perfectly, and I can't find anything at all different about them -- same specs, permissions, etc. as the ones that don't work! The same images that won't work DO work in other programs, like Mail. Did permission repair, all 3rd party stuff turned off...
    What else is there that I could check out?

    I might be wrong, but ...
    I know Microsoft Office 2011 is Mountain Lion compatible.  In fact, Microsoft released updates to it right around the time of Mountain Lion's release to assure compatibility.
    I do not believe Microsoft Office 2008 is Mountain Lion compatible.

  • Can't drag icons out of my dock

    I can't drag files out of stacks (Downloads or Application folders) or app icons off my dock. I reset my SMC when I rebooted and it worked but then I reboot the next day (today) and it won't work anymore. Do I really have to reset SMC every time I boot up? I recently downgraded from Yosemite because it is incomplete and full of bugs and now I have this issue.
    OS X: 10.9.5

    For downloads, go to your user folder downloads and remove them there. Same for Applications. To remove alias from the Dock hold down the command key while dragging them from the Dock.
    If that does't work, go to Finder and select your user/home folder. With that Finder window as the front window, either select Finder/View/Show View options or go command - J.  When the View options opens, check ’Show Library Folder’. Then try a Dock reset.
    Try doing a Dock restart using the following Terminal command:
    killall Dock
    Log out/in and test. If that doesn’t work, you need to look in your user Library/Applications Support/Dock for the .db. Use the Finder “Go To Folder” command. Enter ~/Library/Applications Support/Dock.  Move the .db to your desktop.
    Then try a dock reset.
    Applications/Utilities/Terminal enter the command
    killall Dock
    Log out/in test. If it works okay, delete the .db from the desktop.
    If the Dock is the same, return the .db to where you got them from, overwriting the newer ones.

Maybe you are looking for

  • Save first 45 day 4G iPhone deserted owners

    Hello everyone. I am trying to understand the mindset of those who offer Cheese to the whiners and talk smack at them. The iPhone is a ground breaking product. Apple is famous for its rock-solid products both on the hardware and software fronts that

  • Itunes lost due to harddrive wipe

    how do I get my account back on my laptop ... I am going round and round in support and cannot find an answer. hardrive wiped due to crash and computer repair. I know my username and password but when I try to download a new itunes it won't recognize

  • Crystal Reports 9 and Windows Server 2003 sp1/sp2

    Post Author: jnribeyrol CA Forum: General Hello, due to security updates in my company, we have to upgrade from Windows Server 2003 to sp1 or sp2. I haven't been able in the support to find out if there was any problem with Report Access Server on th

  • ISE 1.3 Sponsor Portal.

    Hi There, Just trying out ISE Version 1.3 and encountering some issues getting access to the sponsor portal. Just checking about a Standalone deployment is it OK to have the sponsor portal interface the same as you manage the ISE from? I cant seem to

  • Can I download and use the cutePDF writer on MacBookPro running Lion?

    Can I download and use the cutePDF writer on MacBookPro running Lion?