# Image still while background scrolls

**URL:** <https://forum.kirupa.com/t/image-still-while-background-scrolls/287482>\
**Category:** flash\
**Created:** [May 1, 2009, 7:57pm UTC](https://forum.kirupa.com/t/image-still-while-background-scrolls/287482 "2009-05-01T19:57:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ExchangeSh9](https://avatars.discourse-cdn.com/v4/letter/e/4491bb/32.png) [@ExchangeSh9](https://forum.kirupa.com/u/ExchangeSh9)\
**Post date:** [May 1, 2009, 7:57pm UTC](https://forum.kirupa.com/t/image-still-while-background-scrolls/287482/1 "2009-05-01T19:57:06Z")

</div>

Hello people basically I am at university and having trouble with one of my assignments, I am new to actionscripting unfortunatley :(. The first problem I am having is that we are using packages to code the work and I have one object draggable but it does not detect when i try to place it on top of another image.

The other problem is that I do not know how to set an image in a set location while my background is scrolling.

Please help asap thank you

package {  
import flash.display.MovieClip;  
import VirtualStudent;  
import VirtualFood;

```
public class TamagociGame extends MovieClip{
    public var bg:VirtualBackground
    public var student:VirtualStudent;
    public var food:VirtualFood;
    public var targetObject:Object;
    
    public function TamagociGame() {
        bg = new VirtualBackground();
        addChild(bg);
        bg.x=150;
        bg.y=stage.stageHeight/2;

        student = new VirtualStudent();
        addChild(student);
        student.x=470;
        student.y=260;
        
    }
    
    public function VirtualFoodCollision(student:Object){
        food = new VirtualFood()
        addChild(food);

        targetObject=student;
        
        food.addEventListener(Event.ENTER_FRAME, onFoodEnterFrame);

         function onFoodEnterFrame(e:Event):void {
            if ( food.hitTestObject(student))
            {
                food.removeEventListener(Event.ENTER_FRAME, onFoodEnterFrame);
                removeChild(food);
            }
        }
    }
}

```

}
