2 Replies Latest reply on Sep 16, 2006 9:27 PM by Newsgroup_User

    resizing the stage

    Level 7
      Hi all,

      I have seen the technote on resizing your stage at:
      http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_12609

      To resize to fill the monitor you can have:
      (the stage).rect = the desktopRectList[1]
      (the stage).drawRect = the desktopRectList[1]

      If I want to resize my stage down to 512 x 384 and from 100, 100 from
      the top left corner, I can use:
      (the stage).drawRect = rect(0, 0, 512, 384)
      (the stage).rect = rect(100, 100, 612, 484)

      But, how would I do the above but just centre the new sized stage on the
      monitor?

      Thanks.


        • 1. Re: resizing the stage
          Level 7
          a lil' math 'l do it.

          take half of the monitor with and subtract from that half of the stage
          width. Do the same with the veritcal component

          if your monitor is 1600 wide and your stage is 400, your rect's starting
          location horizontally would be

          1600/2 - 400 / 2

          then to that add the stage width to get the right side of the rect...and
          again, do the same with the vertical components.



          --
          Craig Wollman
          Word of Mouth Productions

          phone 212 928 9581
          fax 212 928 9582
          159-00 Riverside Drive West #5H-70
          NY, NY 10032
          www.wordofmouthpros.com


          "John" <webforumsuser@macromedia.com> wrote in message
          news:450BEBFD.CBEAF4D9@macromedia.com...
          > Hi all,
          >
          > I have seen the technote on resizing your stage at:
          > http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_12609
          >
          > To resize to fill the monitor you can have:
          > (the stage).rect = the desktopRectList[1]
          > (the stage).drawRect = the desktopRectList[1]
          >
          > If I want to resize my stage down to 512 x 384 and from 100, 100 from
          > the top left corner, I can use:
          > (the stage).drawRect = rect(0, 0, 512, 384)
          > (the stage).rect = rect(100, 100, 612, 484)
          >
          > But, how would I do the above but just centre the new sized stage on the
          > monitor?
          >
          > Thanks.
          >
          >


          • 2. Re: resizing the stage
            Level 7
            Hi John,

            The above advice would solve work. Just to add something to the mix. Say the
            application was played on various sized monitors, you could save the initial
            settings in a variable.

            For example - Movie Script:
            on startMovie
            global gStartSize
            gStartSize = (the stage).rect
            end

            The above stores the starting stage size and location. Assuming the starting
            size is 800x600 centred (which would be known), you can set the size to 1024
            x 768 and centred as follows:

            Behavior atatched to a button:
            on mouseUp
            global gStartSize

            (the stage).drawRect = rect(0, 0, 1024, 768)
            (the stage).rect = gStartSize - rect(112, 84, 0, 0) + rect(0, 0, 112, 84)
            end

            The numbers above were gained by:
            Width difference
            1024 (new size) - 800 (original size) = 224
            to be centred, you'd want 224/2 = 112 on each side (left and right)

            Height difference
            768 (new size) - 600 (original size) = 168
            to be centred, you'd want 168/2 = 84 on each side (top and bottom)

            So, the line
            (the stage).rect = gStartSize - rect(112, 84, 0, 0) + rect(0, 0, 112, 84)
            moves the stage left and up 112 and 84 respectively (by first subtracting
            this from the intital settings) then adds 112 and 84 to increase keep the
            stage size 1024 x 768

            regards
            Dean

            Director Lecturer / Consultant
            http://www.fbe.unsw.edu.au/learning/director
            http://www.multimediacreative.com.au