# Scrolling help

**URL:** <https://forum.kirupa.com/t/scrolling-help/57416>\
**Category:** flash\
**Created:** [July 13, 2004, 2:05am UTC](https://forum.kirupa.com/t/scrolling-help/57416 "2004-07-13T02:05:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chungus](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@Chungus](https://forum.kirupa.com/u/Chungus)\
**Post date:** [July 13, 2004, 2:05am UTC](https://forum.kirupa.com/t/scrolling-help/57416/1 "2004-07-13T02:05:00Z")

</div>

Pfft, what a waste of a debut post. :sleep:

I’m a flash programmer and animator from Synj forums. I’m in charge of programming the AHP… and I need to get it too scroll like Alien Hominid.  
Scrolling is new to me, so I basiclly had it:  
onClipEvent(enterFrame) {  
if (Key.isDown(Key.RIGHT)) {  
\_root.bg.\_x-=10;  
}  
}  
(I also had it scrolling left)  
That worked fine, but then Gel told me to make it scrolling like AH - get to a certain area and scroll.  
Since scrolling is new to me, I had no idea what to do, so I had this put in:  
onClipEvent (enterFrame) {  
if (end.hitTest(\_root.player)) {  
\_root.gotoAndStop(3);  
}  
}  
Frame three had the map at the point in the map where the player was… I mean, the point in which I wanted the map to start scrolling.

That worked but not as nice as I wanted it too. I was wondering if you guys could help me? I want it too scroll when the timer has gone past, say, 30 seconds, or so, and then start to scroll… play AH to see what I mean.  
I’ve made some tries, and haven’t figured it out. Don’t worry, I’m not someone who’d just ask without working ofr it. 😛

So, if any of you can help, it’d be greatly apprecatied.  
That works, but not as well

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 12:14pm UTC](https://forum.kirupa.com/t/scrolling-help/57416/2 "2004-07-13T12:14:48Z")

</div>

“I want it too scroll when the timer has gone past, say, 30 seconds,”  
… you could use setInterval to call a scroll function.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 8:55pm UTC](https://forum.kirupa.com/t/scrolling-help/57416/3 "2004-07-13T20:55:18Z")

</div>

//You will put this code on the movie clip that makes the movie scroll.  
onClipEvent (load) {  
// replace 400 with your stage’s width.  
stage\_width = 400;  
}  
onClipEvent (enterFrame) {  
if (Key.isDown(Key.RIGHT)) {  
//50 is the amount of space the movie clip has to be  
//across the stage before the bg moves.  
if (this.\_x\>=((stage\_width/2)+50)) {  
\_root.bg.\_x -= 10;  
} else {  
this.\_x++;  
}  
}  
if (Key.isDown(Key.LEFT)) {  
if (this.\_x\<=((stage\_width/2)-50)) {  
\_root.bg.\_x += 10;  
} else {  
this.\_x–;  
}  
}  
}

Hope this at least gets you on the right track. Good luck! :red:
