# Drawing inside a Scrollpane

**URL:** <https://forum.kirupa.com/t/drawing-inside-a-scrollpane/264359>\
**Category:** flash\
**Created:** [June 25, 2008, 11:32am UTC](https://forum.kirupa.com/t/drawing-inside-a-scrollpane/264359 "2008-06-25T11:32:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tatianarusso197](https://avatars.discourse-cdn.com/v4/letter/t/e19adc/32.png) [@tatianarusso197](https://forum.kirupa.com/u/tatianarusso197)\
**Post date:** [June 25, 2008, 11:32am UTC](https://forum.kirupa.com/t/drawing-inside-a-scrollpane/264359/1 "2008-06-25T11:32:54Z")

</div>

Hi, I’m trying to create a draw program in AS2 where I can draw shapes with my mouse inside a Scrollpane. Furthermore, I need to be able to drag and drop these objects within the Scrollpane. Currently, I’m doing the following:

1. I created an empty movie clip called _main_ and I’m attaching it inside the Scrollpane called _scroll_
2. I draw the objects inside another empty movie clip called _p0_, _p1_, _p2_, etc. which I’m attaching inside _main_.

When I drag the objects around, they can be dragged outside the boundaries of the Scrollpane. How can I prevent that from happening?

---

<div class="post-metadata">

**Author:** ![sparkdemon](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@sparkdemon](https://forum.kirupa.com/u/sparkdemon)\
**Post date:** [June 25, 2008, 10:25pm UTC](https://forum.kirupa.com/t/drawing-inside-a-scrollpane/264359/2 "2008-06-25T22:25:24Z")

</div>

1. create a empty movieclip in library… and call it “holder” by linkage identifier

2. drag a scroll pane component to stage and set its contentpath parameter to “holder” by component parameter panel.

3. if you have any problems you can also do it via actionscript  
scrollpaneinstance.contentPath=“holder”; // it will automatically attach from library

4. store this path as:

var container=scrollpaneinstance.contentPath;

1. Now attach what ever you want to container using you favorite attachMovieClip function

🙂 hope it helps

---

<div class="post-metadata">

**Author:** ![tatianarusso197](https://avatars.discourse-cdn.com/v4/letter/t/e19adc/32.png) [@tatianarusso197](https://forum.kirupa.com/u/tatianarusso197)\
**Post date:** [June 26, 2008, 12:17am UTC](https://forum.kirupa.com/t/drawing-inside-a-scrollpane/264359/3 "2008-06-26T00:17:58Z")

</div>

Thank you, it sure did!!!

---

<div class="post-metadata">

**Author:** ![sparkdemon](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@sparkdemon](https://forum.kirupa.com/u/sparkdemon)\
**Post date:** [June 26, 2008, 12:21am UTC](https://forum.kirupa.com/t/drawing-inside-a-scrollpane/264359/4 "2008-06-26T00:21:14Z")

</div>

welcome 🙂
