# Extract bounding area of MC with random content

**URL:** <https://forum.kirupa.com/t/extract-bounding-area-of-mc-with-random-content/264880>\
**Category:** Uncategorized\
**Created:** [July 1, 2008, 3:56pm UTC](https://forum.kirupa.com/t/extract-bounding-area-of-mc-with-random-content/264880 "2008-07-01T15:56:21Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrickjv](https://avatars.discourse-cdn.com/v4/letter/p/ce7236/32.png) [@patrickjv](https://forum.kirupa.com/u/patrickjv)\
**Post date:** [July 1, 2008, 3:56pm UTC](https://forum.kirupa.com/t/extract-bounding-area-of-mc-with-random-content/264880/1 "2008-07-01T15:56:21Z")

</div>

I have a main movieclip with a bunch of ‘flies’-MCs flying around randomly in it. If the main mc is placed in main timeline, is there a way to retrieve the actually covered area of the main mc at a certain moment… imagine a snapshot bounding box of all flies at that specific moment.  
tia  
P.

---

<div class="post-metadata">

**Author:** ![pantas](https://avatars.discourse-cdn.com/v4/letter/p/3e96dc/32.png) [@pantas](https://forum.kirupa.com/u/pantas)\
**Post date:** [July 1, 2008, 4:03pm UTC](https://forum.kirupa.com/t/extract-bounding-area-of-mc-with-random-content/264880/2 "2008-07-01T16:03:05Z")

</div>

check the help files for the draw function!

---

<div class="post-metadata">

**Author:** ![patrickjv](https://avatars.discourse-cdn.com/v4/letter/p/ce7236/32.png) [@patrickjv](https://forum.kirupa.com/u/patrickjv)\
**Post date:** [July 1, 2008, 6:25pm UTC](https://forum.kirupa.com/t/extract-bounding-area-of-mc-with-random-content/264880/3 "2008-07-01T18:25:21Z")

</div>

hm… been trying “draw()” in combo with “getColorBoundsRect” but can’t seem to get the correct bounding-box(rectangle) extraction when pouring my MC-with-random-stuff into a BitmapData object.

possibly a matter of color choice or syntax or values. I’ve attached testing .fla if anyone wants to take a peek, appreciated.  
P.

---

<div class="post-metadata">

**Author:** ![patrickjv](https://avatars.discourse-cdn.com/v4/letter/p/ce7236/32.png) [@patrickjv](https://forum.kirupa.com/u/patrickjv)\
**Post date:** [July 2, 2008, 12:43am UTC](https://forum.kirupa.com/t/extract-bounding-area-of-mc-with-random-content/264880/4 "2008-07-02T00:43:34Z")

</div>

Although I would prefer to have an AS2 and AS3 method, I found that in AS3 one can use getBounds or getRect. See attachment (experiment2c.fla).

I haven’t been able to modify it to AS2 yet. Anybody any idea how to correct the draw() + getColorBoundsRect() to get same data (experiment2aa.fla), those probably could work in AS2 as well?  
P

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [July 2, 2008, 1:45am UTC](https://forum.kirupa.com/t/extract-bounding-area-of-mc-with-random-content/264880/5 "2008-07-02T01:45:35Z")

</div>

What’s wrong with getBounds in AS2?

---

<div class="post-metadata">

**Author:** ![patrickjv](https://avatars.discourse-cdn.com/v4/letter/p/ce7236/32.png) [@patrickjv](https://forum.kirupa.com/u/patrickjv)\
**Post date:** [July 2, 2008, 1:58am UTC](https://forum.kirupa.com/t/extract-bounding-area-of-mc-with-random-content/264880/6 "2008-07-02T01:58:04Z")

</div>

Isn’t it AS3 only?

Help documentation;  
Language Version : ActionScript 3.0  
Player Version : Flash Player 9

did i miss something?

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [July 2, 2008, 3:04am UTC](https://forum.kirupa.com/t/extract-bounding-area-of-mc-with-random-content/264880/7 "2008-07-02T03:04:40Z")

</div>

Well quit looking in the AS3 reference 😛

It’s been around since FP5.

---

<div class="post-metadata">

**Author:** ![patrickjv](https://avatars.discourse-cdn.com/v4/letter/p/ce7236/32.png) [@patrickjv](https://forum.kirupa.com/u/patrickjv)\
**Post date:** [July 2, 2008, 5:30am UTC](https://forum.kirupa.com/t/extract-bounding-area-of-mc-with-random-content/264880/8 "2008-07-02T05:30:24Z")

</div>

hmm… tried it out but it returns [type Object] when tracing.

I have an mc instance “mmc” in root, and script  
var effectarea = mmc.getBounds(this)  
trace(effectarea)

it’s not tracing a rectangle as in AS3 e.g. (x=166.75, y=172.75, w=58.25, h=52.25)  
must be close to working correctly, no?

---

<div class="post-metadata">

**Author:** ![patrickjv](https://avatars.discourse-cdn.com/v4/letter/p/ce7236/32.png) [@patrickjv](https://forum.kirupa.com/u/patrickjv)\
**Post date:** [July 2, 2008, 5:39am UTC](https://forum.kirupa.com/t/extract-bounding-area-of-mc-with-random-content/264880/9 "2008-07-02T05:39:38Z")

</div>

found it …

clipBounds = clip.getBounds(\_root);  
clip2.\_x = clipBounds.xMax;

solution lies in xMin, xMax , yMin, yMax…

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [July 2, 2008, 5:48am UTC](https://forum.kirupa.com/t/extract-bounding-area-of-mc-with-random-content/264880/10 "2008-07-02T05:48:32Z")

</div>

Yeah it returns a regular object with properties xMax, xMin, yMax and yMin - not a Rectangle as in AS3.
