8 Replies Latest reply on Aug 10, 2006 7:34 PM by wgb14

    Read the loc of a MIAW

    wgb14 Level 1
      Hi all

      I would like to position a MIAW on the screen (relative to the stage) and read its exact coordinates (x,y). Is there any way to do that?

      Many thanks
        • 1. Re: Read the loc of a MIAW
          wgb14 Level 1

          I found this "put the rect of mymovie" where mymovie is my MIAW object. I am not sure if that is correct. Any ideas?

          • 2. Re: Read the loc of a MIAW
            Level 7
            "put the rect of mymovie" will only display the rect of the movie in the
            message window, but you are on the right track. Both the stage and any MIAWs
            have a rect property. You can position your MIAW by settings its rect
            property. Using simple addition calculate the rect in such a way that it is
            relative to the rect of the stage.

            Is that enough info, or do you need more? If you need more, tell me where
            you want the MIAW in relation to the stage and I will give you the lingo
            which will do it.

            • 3. Re: Read the loc of a MIAW
              Level 7
              Here is an example. The assumptions are:

              * The director file to be opened in a MIAW is named "myMovie"
              * The MIAW is opened by clicking on some object
              * You want the MIAW to have a title bar
              * You want the MIAW to vertically align with the left side with the stage
              * You want the top of the MIAW to be just below the bottom of the stage

              on mouseUp me
              newWindow = window("myMovie")
              newWindow.windowType = 4
              w = newWindow.rect[3] - newWindow.rect[1]
              h = newWindow.rect[4] - newWindow.rect[2]
              newWindow.rect = rect(the stageLeft, the stageBottom + 30,the stageLeft +
              w,the stageBottom + h + 30)
              open newWindow

              The one thing I don't know how to do is determine the exact size of the
              title bar, so I am using a hard coded value of 30. The code above can be
              adjusted to make the MIAW appear just about anywhere you want relative to
              the stage.

              • 4. Re: Read the loc of a MIAW
                wgb14 Level 1
                The script won't work in my version of Director (MX 2004). Can we update it somehow?

                Many thanks
                • 5. Re: Read the loc of a MIAW
                  wgb14 Level 1
                  Flase alarm!!! It is working but i would liek the MIAW to appear on the stage and not on its left side.Any idea on how to do that?

                  • 6. Re: Read the loc of a MIAW
                    wgb14 Level 1
                    Well, I can see the difference now. In 1024x768 resolution your script makes my window to dissapear. In a smaller analysis (e.g., 400x250) it works fine. Any idea why this is happening?
                    • 7. Re: Read the loc of a MIAW
                      Level 7
                      "I would like the MIAW to appear on the stage "

                      You are not describing specifically where on the stage you want it to
                      appear. The stage has a rect property, it describes the two points which
                      define a rectangle that completely surrounds the stage. Type 'put the
                      stage.rect' in the message window, press enter and it might return something
                      like rect(100, 100, 250, 300). This tells you the coordinates of two points
                      on the screen, the upper left corner and the lower right corner of the
                      rectangle. The the top, left corner of the screen is defined as point (0,0).

                      Just like the stage, every MIAW has a rect property as well. The rect
                      property not only tells you where the two corners of the rectangle is, but
                      you can calculate the width and height of the rectange using subtraction. A
                      rect has the form (x1,y1,x2,y2). So the width of the rect is x2-x1 and the
                      height is y2-y1. This is the h & w variables used in the code.

                      Why is all of this of important? Because you will be setting the rect of the
                      MIAW and you do not want to make it smaller than the stage size that you set
                      inside the director movie itself (meaning the one that you are loading into
                      the MIAW). If the rect of the MIAW is too small, part of movie will not be

                      To position your rect, you need to think about where a particular point in
                      the MIAW needs to be relative to another point on the stage. For example you
                      may want the top-left corner of the MIAW to lie directly over the top left
                      corner of the stage. Maybe you want their centers aligned. Once you have
                      determined this, you will probably use one of these special variables when
                      you set the rect; the stageTop, the stageBottom, the stageLeft, the

                      • 8. Re: Read the loc of a MIAW
                        wgb14 Level 1

                        I found that by placing a rectangular of the same size as MIAW int he location i want on the stage and record its x,y values and update the location (the location field int he display properties of the MIAW) of my MIAW accordingly works just fine for me. When i open my movie the MIAW is in exactly the place that i want it to be. But in any way many thanks for this explanation on MIAWs it is very helpfull.

                        Many thanks again