Easy 4 page site with buttons and slideshow on page 1:
Each red button takes you to each page (each page is on 1 slide) like this:
stop();
Btn1.onPress = function()
{
gotoAndStop(1);
};
Btn2.onPress = function()
{
gotoAndStop(2);
};
Btn3.onPress = function()
{
gotoAndStop(3);
};
Btn4.onPress = function()
{
gotoAndStop(4);
};
The stop(); and gotoAndStop(number); makes sure it stops on that specific page (or frame). As you can see the first images are on the first page. All four images are on the first frame and the left and right arrows underneath the image change what images is on screen.
I did this by going inside the image so it is in its own library (double clicking the image).
once here I am given a fresh timeline, so I can give this image its own timeline. I place a different image on each frame, four in total of characters from a video game.
I made the buttons go from left to right by naming them individually and placing their name in this code:
stop();
nextBtn.onPress = function (){
nextFrame();
}
backBtn.onPress = function (){
prevFrame();
}
This was placed in frames two and 3 only because it would not loop the images when i got to the end of the left or right. For that I had to change what the buttons did on the two ending frames, 1 and 4.
On frame 1 the small change was:
PrevFrame(4);
Making the left button go from frame 1 to frame 4 while the right button stays the same.
On frame 4 it is the other way around, the difference being:
gotoAndstop(1);
making the right button go from frame 4 to frame.
Doing this gives the slideshow a smooth feel of an endless cycle through these four images
Slide 1 and 4 on the actionscript timeline had to have their own coding while frames 2 and 3 shared the same frames so they had the same effect of going left and right normally.
Once back into the main scene he timeline goes back to normal. Its like a timeline within a timeline.
No comments:
Post a Comment