4 Replies Latest reply on Nov 29, 2006 12:53 AM by Devendran

    How to determine a movieclip width

    Devendran Level 1
      Hi Experts,
      Don't think this is a Very basic question. I am having a Circle(Say 100x100) in a movie clip. If you trace the width of the Move clip it will show exactly 100x100. Well.

      Now rotate the movieclip for 45 degrees(or some other degrees). Now trace the MovieClip width. It will show u Some Value(Not 100x100). Actually the Content is a circle so what ever i rotate i would like to get the exact width of the content. (this is not only for circle, but also for rectangle and other Shapes). (This happens because of the Boundry rectangle formed by the Object).

      Any help is appriciated.
        • 1. Re: How to determine a movieclip width
          Its a good question...actually when u rotate the circle or rectangle the width n height are based on global coordinate space thats y the bounding box which become rhombus type on rotation tends to show u increased width and height......there is no direct method that i cud find but yes u cn use combination of things to get the exact width n height that ll always remains d same i.e. independent of the rotation...u cn use the following code

          var cc:object = mc.getBounds(this.mc);

          for (var i in cc) {
          trace(i+"="+cc );
          i hope u know for...in loop..
          here cc is an Object which returns the properties xMin, xMax, yMin, and yMax
          mc is ur movie clip, u have to pass this movie clip as a parameter to getBounds function to map ur global coordinate space to movie clip local space...With this method u ll always get the same xMin,xMax,yMin,yMax values even if u rotate ur movie clip ..u cn then deduct these values like xMax- xMin to get the width or height... Remember however this method ll also include the stroke width.

          i hope this ll help u
          • 2. How to determine a movieclip width
            Devendran Level 1
            Hi ,
            Thank you for your Response. Actually i m using the Same Method(getBounds to Calculate the Value. But unfortunately i used (myClip.getBounds(_root)). After testing your code i got The exact Width and height of the movieClip(width and height on 0 degree rotation). But i would like to calculate the Movie clip content width in rotated position. If i m having a irregular shape and rotating it. When i trace the Movie width it will show us the Bounded rectangle width, but Actually the content with may Less than that Bounded rectangle
            • 3. Re: How to determine a movieclip width
              or you could just get the width and height before you rotate and store that as a value and know that its always going to be that width and height rather than performing getBounds after you rotate. seems weird to think the width and height are going to change unless you scale. unless you are talking about the farthest left and right points of the object you are rotating.
              • 4. Re: How to determine a movieclip width
                Devendran Level 1
                This is also a simplified answer. Great. First of all. I m looking to calculate the Rotated MovieClip's content width. i have explained it in another forum.

                http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=288&threadid =1217850&enterthread=y

                Please Take a look at this... I need a Solution for this one. This one is went to off the topic.