# Scrolling mc by entering frame?

**URL:** https://forum.kirupa.com/t/scrolling-mc-by-entering-frame/162324
**Category:** Uncategorized
**Created:** [September 12, 2005, 8:30am UTC](https://forum.kirupa.com/t/scrolling-mc-by-entering-frame/162324 "2005-09-12T08:30:50Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![midnite](https://avatars.discourse-cdn.com/v4/letter/m/c2a13f/32.png) [@midnite](https://forum.kirupa.com/u/midnite)
#### Post date: [September 12, 2005, 8:30am UTC](https://forum.kirupa.com/t/scrolling-mc-by-entering-frame/162324/1 "2005-09-12T08:30:50Z")

</div>

[color=#000087]hi there…[/color]

i have a site i’m working on where i currently have the stage scroll left or right when a button is pressed. each button has an instance name, and the stage is an mc with the following code:

[color=#000087]

```auto
onClipEvent[/color] ([color=#000087]load[/color]) {
[color=#000087]_x[/color] = 0;
[color=#000087]_y[/color] = 0;
div = 5;
}[color=#000087]onClipEvent[/color] (enterFrame) {
[color=#000087]_x[/color] += (endX-[color=#000087]_x[/color])/div;
[color=#000087]_y[/color] += (endY-[color=#000087]_y[/color])/div;
[color=#000087]_root[/color].home.[color=#000087]onRelease[/color] = [color=#000087]function[/color]() {
endX = 0;
endY = 0;
};
[color=#000087]_root[/color].music.[color=#000087]onRelease[/color] = [color=#000087]function[/color](){
endX = -300;
endY = 0;
}; [color=#000087]_root[/color].biography.[color=#000087]onRelease[/color] = [color=#000087]function[/color]() {
endX = -600;
endY = 0;
};
}

```

this works great, but now i need to change this so that the scrolling starts when another mc reaches a frame, instead of when a button is pressed.

so like, when the “biography” button is pressed, rather then scroll the stage, it’s now going to tell a mc on the stage to play an exit animation. when that animation ends, i need the last frame to tell the stage to scroll to the desired destination. hopefully that makes sense.

i’m having a hard time figuring out the syntax to transfer my onrelease function to an onenterframe function. any help would be most appreciated! :thumb:
