5 Replies Latest reply on Nov 25, 2007 2:58 PM by Opera Rat

    Getting MIAW to open in right spot

    Opera Rat Level 1
      I thought I had this issue solved months ago. Then I got a new wide screen monitor and was frustrated that this MIAW is once again a problem.

      I designed my main movie to be 1024 x 768, full-screen and centered. I originally did this on my small 15" monitor so that it would take up the entire screen. That monitor can only support up to 1024 x 768, so became my minimum requirement for all my users-to-be. An MIAW opens when the program starts and on that monitor it opened in just the right spot. THEN I opened the program on my wide screen (1680 x 1050) and the program takes up the middle of the screen and the MIAW is in the completely wrong spot.

      I'm not sure how I'm going to handle different size monitors yet (I just know that I never want my interface to stretch out on a wide screen). But I want my MIAW to be in the same spot on the interface no matter what the screen size and what the resolution. This is the code I have been using:


      tWindow = window().new(gMIAWFugue)
      tWindow.filename = "@/music/fugues/"&gMIAWFugue
      tWindow = window gMIAWFugue
      d = window("stage").rect
      tWindow.rect = tWindow.sourceRect.offset(66, 30)
      tWindow.open()

      This script went through many changes and I was away from designing this program for several months, so I can't remember what everything is (like "d"). But I must have kept if for a reason. This is the script that works in 1024 x 768, but is screwed up on a wide screen.

      So my question is two-fold: 1. What do I do about the variety of screen sizes, and 2. how do I get my MIAW to open in the right spot no matter the screen size or resolution (above 1024 x 768). This program requires Win XP or OS X. So having the program change the users resolution is fine with me, but not stretched on a wide screen?
        • 1. Re: Getting MIAW to open in right spot
          Level 7
          If you open the dir for the MIAW, go to the Display Template tab and
          check the box for Centered. That should force it to open in the center
          of the monitor, regardless of screen size/resolution. This would be the
          command to open it:

          window().new(gMIAWFugue).open()
          • 2. Re: Getting MIAW to open in right spot
            Level 7
            > If you open the dir for the MIAW, go to the Display Template tab and
            > check the box for Centered. That should force it to open in the center
            > of the monitor, regardless of screen size/resolution.

            I'm not sure, but I think the "centered" option records the rect based
            on the current screen resolution.

            Better instead to place your MIAW relative to the rect of your stage -
            which it looks like you were going to do at one point since you grab a
            reference to it:
            tWindow = window().new(gMIAWFugue)
            tWindow.filename = "@/music/fugues/"&gMIAWFugue
            -- tWindow = window gMIAWFugue -- no need to do this
            d = window("stage").rect
            tWindow.rect = d.offset(66, 30)
            tWindow.open()
            • 3. Re: Getting MIAW to open in right spot
              Opera Rat Level 1
              Thanks guys. I should have been clearer. My main movie is centered, but the MIAW is not centered to anything.

              Sean, you code worked, but now the MIAW is drawing a rect the same size as the main movie. The upper left corner is in the right spot, but it contains my movie with a black, left and bottom side. My main movie is 1024 x 768 and my MIAW is 860, 380).

              This leads me to another question. My MIAW movie keeps reverting back to a location other than zero, zero in the Display Template box when I make changes to the movie. I think it wants to start it at 69 and 252. Is this some kind of default?
              • 4. Re: Getting MIAW to open in right spot
                Level 7
                > Sean, you code worked, but now the MIAW is drawing a rect the same size as the
                > main movie. The upper left corner is in the right spot, but it contains my
                > movie with a black, left and bottom side. My main movie is 1024 x 768 and my
                > MIAW is 860, 380).

                Yes, of course. Sorry about that. Assuming you want your MIAW to sit 66
                px in from the left of your stage window, and 30 down from the top, try:
                --
                tWindow = window().new(gMIAWFugue)
                tWindow.filename = "@/music/fugues/"&gMIAWFugue
                sr = tWindow.sourceRect
                d = window("stage").rect
                r = rect(d[1], d[2], d[1] + sr.width, d[2] + sr.height)
                tWindow.rect = r.offset(66, 30)
                tWindow.open()
                • 5. Re: Getting MIAW to open in right spot
                  Opera Rat Level 1
                  Thank you. It works. I could have never figured that out. It looks like it's going to take me a while to get back into lingo.