# \[AS3\] scrollRect Weirdness

**URL:** <https://forum.kirupa.com/t/as3-scrollrect-weirdness/222095>\
**Category:** flash\
**Created:** [April 10, 2007, 7:36pm UTC](https://forum.kirupa.com/t/as3-scrollrect-weirdness/222095 "2007-04-10T19:36:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sarahelizabeth](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/sarahelizabeth/32/2493_2.png) [@sarahelizabeth](https://forum.kirupa.com/u/sarahelizabeth)\
**Post date:** [April 10, 2007, 7:36pm UTC](https://forum.kirupa.com/t/as3-scrollrect-weirdness/222095/1 "2007-04-10T19:36:08Z")

</div>

I’m getting some weird behavior while trying to build a scrollbar in as3. I’ve applied a scrollRect to the movieclip I want to scroll:

```auto

public function create(targ, w, h):void{
            trace('Scrollbar: Create');
            this.targ = targ;
            this.w = w;
            this.h = h;
            trace("targ.height is: "+targ.height);
            this.targ.scrollRect = new Rectangle(0, 0, this.w, this.h);
            trace("targ.height is: "+targ.height);
            scrollpos=0;
            checkComponents();
        }

```

Both the traces before and after trace out the correct value, in this case 267. However, once I call any sort of mouseEvent (applied to the targ, the arrows used for the scrollbar… etc) it traces the height of targ as 125 - the height of the scrollRect. Is this a bug? Am i missing something about scrollRect?

Thanks,  
Sarah
