Scrolling Image Gallery
| Category | : Flash | Views | : 31033 | ||
| Version | : 8 | Rating | : | ||
| Type | : Text | Source File | : scrolling-image-gallery.zip | ||
| Result | : See the result | ||||
Place the buttons on each side of the "Scroller":

Open the actions for the main timeline and paste:
//to know whether the buttons are pressed or not
var aPressed = false;
var speed;
aLeft.onPress = function()
{
//set the right button to visible
_root.aRight._visible = 1;
//button is pressed so se to true
_root.aPressed = true;
//speed is positive so it will go to the right
_root.speed = 5
}
aLeft.onRelease = function()
{
//button released so key isn't pressed
_root.aPressed = false;
}
aRight.onPress = function()
{
//left button set to visible
_root.aLeft._visible = 1;
//button pressed
_root.aPressed = true;
//speed negative so will go to the left
_root.speed = -5
}
aRight.onRelease = function()
{
//released
_root.aPressed = false;
}
this.onEnterFrame = function()
{
//if a button is being pressed
if(aPressed)
{
//if hit the limit in the left
if (_root.Scroller.Scroll._x + speed == -100)
{
//pressed set to false
aPressed = false;
//right button invisible
aRight._visible = 0
//leave this so we don't go left
return;
}
//if hit the limit in the right
else if(_root.Scroller.Scroll._x + speed == 5)
{
aPressed = false;
//left button invisible
aLeft._visible = 0
return;
}
//if is positive will go to the right or negative to the left
_root.Scroller.Scroll._x += speed;
}
}
Done! Test it to see the results.
![]() |
![]() |
![]() |
![]() |
![]() |




