# Object moves with scrollrect - help!

**URL:** <https://forum.kirupa.com/t/object-moves-with-scrollrect-help/324401>\
**Category:** Uncategorized\
**Created:** [August 18, 2011, 8:50pm UTC](https://forum.kirupa.com/t/object-moves-with-scrollrect-help/324401 "2011-08-18T20:50:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![drpelz](https://avatars.discourse-cdn.com/v4/letter/d/c68b51/32.png) [@drpelz](https://forum.kirupa.com/u/drpelz)\
**Post date:** [August 18, 2011, 8:50pm UTC](https://forum.kirupa.com/t/object-moves-with-scrollrect-help/324401/1 "2011-08-18T20:50:45Z")

</div>

Hi folks,

I got a serious problem here: I have a scrolling background that is 1320 x 1000 big. I’m using a sprite as a container where my background canvas is placed inside of it. Additionally I add (via addChild) a score sprite inside of the background sprite (the one that holds the bg canvas so the score appears on top of the bg canvas).

The goal is that when I add a score it shall be stuck to the background (even when the scrollrect moves; it shall have a fixed position on the background).

The problem is that this doesn’t work because when the score appears it moves with the scrollrect and this is not what I want. I already tried it with globalToLocal but had no success yet. Probably because I don’t really understand globalToLocal (and vice versa). Please can anyone help me out with this problem? Thanks in advance.

These are some code excerpts:

```auto

private var backgroundBitmapData:BitmapData = new BitmapData(1320, 1000, false, 0x000000);
private var canvasBitmapData:BitmapData = new BitmapData(1320, 1000, false, 0x000000);//Container fuer alle
        
private var canvasBitmap:Bitmap = new Bitmap(canvasBitmapData);
private var canvasRect:Rectangle = new Rectangle(0, 0, 660, 500);
        
private var backgroundSprite:Sprite = new Sprite();

```

```auto

backgroundSprite.scrollRect = new Rectangle(0, 0, 660, 500);
canvasBitmap.scrollRect = new Rectangle(330, 250, 660, 500);
            
backgroundSprite.addChild(canvasBitmap);
backgroundSprite.cacheAsBitmap = true;
                        
addChild(backgroundSprite);

```

```auto

tempScoreText = new ScoreTextField(String(10), textFormat, oldAstX, oldAstY, 20);
scoreTexts.push(tempScoreText);
backgroundSprite.addChild(tempScoreText);

```
