Ok so our next project is to make a slide show
We need to have a button for each of the following things:
Next
Previous
Auto Play [plays through the show by itself based on a time delay]
Stop [stops the Auto Play]
Each slide is just supposed to be an image and I made my code a bit more basic because of it [I think]
So I went to my sketchbook and wrote in some code
I just want to know if there is anything wrong with it.
I can't type it into Flash cause I don't have the program outside of class.
Anyway, here's what I tried.
//Keep in mind I don't know how to declare variables
bool autoPlay = false; // or will this not work?
int frame = 1;
int delay = 100;
nextButton.addEventListener(MouseEvent.CLICK, nextFrame);
function nextFrame(event)
{
if(frame <= 9)
{
autoPlay = false;
delay = 100;
frame = frame + 1; //is there a ++ or -- thing like in java?
gotoAndStop(frame);
}
}
previousButton.addEventListener(Mouse.Event.CLICK, playPrev);
function playPrev(event)
{
if(frame >= 2)
{
autoPlay = false;
delay = 100;
frame = frame - 1;
gotoAndStop(frame);
}
}
autoButton.addEventListner(MouseEvent.CLICK, autoPlayFunc);
function autoPlayFunc(event)
{
autoPlay = true;
while(autoPlay == true)
{
while(delay > 0)
{
stop();
delay = delay - 1;
}
frame = frame + 1;
gotoAndStop(frame);
}
}
stopButton.addEventListener(MouseEvent.CLICK, stopAuto);
function stopAuto(event)
{
autoPlay = false;
delay = 100;
}
We need to have a button for each of the following things:
Next
Previous
Auto Play [plays through the show by itself based on a time delay]
Stop [stops the Auto Play]
Each slide is just supposed to be an image and I made my code a bit more basic because of it [I think]
So I went to my sketchbook and wrote in some code
I just want to know if there is anything wrong with it.
I can't type it into Flash cause I don't have the program outside of class.
Anyway, here's what I tried.
//Keep in mind I don't know how to declare variables
bool autoPlay = false; // or will this not work?
int frame = 1;
int delay = 100;
nextButton.addEventListener(MouseEvent.CLICK, nextFrame);
function nextFrame(event)
{
if(frame <= 9)
{
autoPlay = false;
delay = 100;
frame = frame + 1; //is there a ++ or -- thing like in java?
gotoAndStop(frame);
}
}
previousButton.addEventListener(Mouse.Event.CLICK, playPrev);
function playPrev(event)
{
if(frame >= 2)
{
autoPlay = false;
delay = 100;
frame = frame - 1;
gotoAndStop(frame);
}
}
autoButton.addEventListner(MouseEvent.CLICK, autoPlayFunc);
function autoPlayFunc(event)
{
autoPlay = true;
while(autoPlay == true)
{
while(delay > 0)
{
stop();
delay = delay - 1;
}
frame = frame + 1;
gotoAndStop(frame);
}
}
stopButton.addEventListener(MouseEvent.CLICK, stopAuto);
function stopAuto(event)
{
autoPlay = false;
delay = 100;
}