I used this technique to create a simple video interface, with thumbnails for each video which had to slide horizontally.
I also needed to stop my carousel movieclip to exit the stage.
First of all I created a movieclip with all my thumbnails inside it and i named the movieclip “carousel”.
I created a mask on that movieclip, to control the visible area of it and on the left and right I created two buttons, which will move left and right my “carousel” movieclip, named “left_btn” and “right_btn”.
All is set now, we’ll create one new layer for the actionscript which controls the buttons and the movieclip.
In previous mentioned frame paste the following actionscript code:
right_btn.onRollOver = function() {
carousel.onEnterFrame = function() {
this._x += 10;
if(carousel._x >= 40){
trace(“edge reached”);
delete carousel.onEnterFrame;
//right_btn._visible = false;
}
};
};
right_btn.onRollOut = function() {
delete carousel.onEnterFrame;
};
left_btn.onRollOver = function() {
carousel.onEnterFrame = function() {
this._x -= 10;
if((carousel._x + carousel._width) <= Stage.width-40){
trace(“edge reached”);
delete carousel.onEnterFrame;
//left_btn._visible = false;
}
};
};
left_btn.onRollOut = function() {
delete carousel.onEnterFrame;
};
If something is not clear, please write a comment and you will get further assistance.
Related posts:
Leave a Comment
Let me know your thoughts on this post but remember to place nicely folks!