diggz
10-27-2005, 08:39 AM
Hi All,
Hope someone can help me out with question that I have.
Basically I have a movie that has a parallax scrolling background that moves in response to the left and right keys being pressed.
It works fine and great but I want to add another element to it, and this is my question - I need some code to paste onto buttons to make the different background movieclips slide to certain positions. ie: the positions that can also be reached using arrow keys.
There are three or four background movie clips that move at different speeds and the code shown below is pasted onto the the hero clip in the centre of the stage:
onClipEvent (load) {
gotoAndStop(1);
this.sonic.gotoAndStop(1);
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
gotoAndStop(1);
this.sonic.play();
_root.land._x -= 1;
_root.mid._x -= 15;
_root.mid2._x -= 11;
_root.mid3._x -= 15;
_root.trees2._x += 1;
_root.trees._x -= 1;
} else if (Key.isDown(Key.LEFT)) {
gotoAndStop(2);
this.sonic.play();
_root.land._x += 1;
_root.mid._x += 15;
_root.mid2._x += 11;
_root.mid3._x += 15;
_root.trees2._x -= 1;
_root.trees._x += 1;
} else {
this.sonic.gotoAndStop(1);
}
Does anyone know and tell me what code I could put on a button that would make these background mc's move to any set x position please?
Really hope someone can share the knowledge with me please :))
Thanks in anticipation
Hope someone can help me out with question that I have.
Basically I have a movie that has a parallax scrolling background that moves in response to the left and right keys being pressed.
It works fine and great but I want to add another element to it, and this is my question - I need some code to paste onto buttons to make the different background movieclips slide to certain positions. ie: the positions that can also be reached using arrow keys.
There are three or four background movie clips that move at different speeds and the code shown below is pasted onto the the hero clip in the centre of the stage:
onClipEvent (load) {
gotoAndStop(1);
this.sonic.gotoAndStop(1);
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
gotoAndStop(1);
this.sonic.play();
_root.land._x -= 1;
_root.mid._x -= 15;
_root.mid2._x -= 11;
_root.mid3._x -= 15;
_root.trees2._x += 1;
_root.trees._x -= 1;
} else if (Key.isDown(Key.LEFT)) {
gotoAndStop(2);
this.sonic.play();
_root.land._x += 1;
_root.mid._x += 15;
_root.mid2._x += 11;
_root.mid3._x += 15;
_root.trees2._x -= 1;
_root.trees._x += 1;
} else {
this.sonic.gotoAndStop(1);
}
Does anyone know and tell me what code I could put on a button that would make these background mc's move to any set x position please?
Really hope someone can share the knowledge with me please :))
Thanks in anticipation