Object moves with scrollrect - help!

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:


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();

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

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