Skip to main content
Known Participant
January 5, 2008
Question

Moving Movie clip with button

  • January 5, 2008
  • 2 replies
  • 274 views
Hello AS wizards everywhere. Can anyone help with this. I have a movie clip which displays a very long horizontal line of thumbnail movie clips which will eventually have actions attached. Right now, I'm trying to find a way of moving the long line to the left or right by 165 pixels. The movie clip I want to move has an instance name "scrollalong" and is part of a movie calIed "scroll thumb nails". I wish to do this with 2 buttons residing on the main timeline called "go left" and "go right". Once I've got to a certain point with the "scrollalong" clip I want to disable the button action so that it won't move.

thank you from a frustrated musician Map of Limbo
This topic has been closed for replies.

2 replies

robdillon
Participating Frequently
January 5, 2008
You'll need to define the right limit point and the left limit point of the scrollalong clip. I'm guessing that the left limit point will be the starting point of the clip. And, that the right limit point will be 165 X the number of thumbnails in the clip.

So you could use something like this from the main timeline:

var leftLimit:Number = scrollThumbNails.scrollalong._x;
var rightLimit:Number = leftLimit + (165 * number of clips);


leftButton.onRelease = function() {

if (scrollThumbNails.scrollalong._x > leftLimit) {
scrollThumbNails.scrollalong._x -= 165;
}
}
rightButton.onRelease = function() {
if (scrollThumbNails.scrollalong._x < rightLimit) {
scrollThumbNails.scrollalong._x += 165;
}
}
kglad
Community Expert
Community Expert
January 5, 2008
increment (and decrement) the _x property of your scrollalong movieclip with the left (and right) button presses. you should give an instance name to your "scroll thumb nails" movieclip so you can logically reference scrollalong.