Wednesday, October 29, 2008

Week 09: Moving Pictures (Actionscripting)

Find below, the Actionscript used in today's example.
In this example, the VIEWER will select a category (SOIL, SOCIETY, SOUL), and then click the NEXT and PREVIOUS buttons to move through the slides that are located in folders.
Each filename is formatted as follows: img#.jpg, where # is a sequential number.
Each file is located in a folder according to the category it fits into.

Include the photo only presentation AND this application in PROJECT#3.

// FRAME SCRIPT
stop();

// SOIL Button
on(release) {
category = "soil"; // what folder to look inside
nextone=1; // what image to play first
limit=5; // number of images in the folder
loadMovie("images/" + category +"/img"+nextone+".jpg", mypics_mc);
}

// SOUL Button
on(release) {
category = "soul";
nextone=1;
limit=2;
loadMovie("images/" + category +"/img"+nextone+".jpg", mypics_mc);
}


/* NEXT Button script */
on (release) {
if (nextone>=limit) {
// Do nothing
} else {
nextone++;
loadMovie("images/" + category +"/img"+nextone+".jpg", mypics_mc);
}
}

/* PREVIOUS button script */
on (release) {
if (nextone<=1) {
// Do nothing
} else {
nextone--;
loadMovie("images/" + category +"/img"+nextone+".jpg", mypics_mc);
}
}

No comments: