Download the source file from here and replace the AS on the actions layer with the code below. Change the highlighted number to set the transition time. You don't need to change anything else.
Note, that I'm using Zeh Fernando's MC Tween for the fading transitions. If you don't have it already, you can download it here.
Code:
#include "mc_tween2.as"
var xml:XML = new XML();
xml.ignoreWhite = true;
var totalQuotes:Number = new Number();
var index:Number = 0;
var delay:Number = 5;
xml.onLoad = function(success) {
if(success) {
totalQuotes = xml.firstChild.childNodes.length;
loadQuote();
}
}
function loadQuote() {
var quote = xml.firstChild.childNodes[index];
if(quote.attributes.title == "") { theQuote._y = 25; }
else { theQuote._y = 45; }
theAuthor.text = quote.attributes.author;
theTitle.text = quote.attributes.title;
theQuote.text = quote.firstChild.nodeValue;
showQuote();
}
function showQuote() {
theAuthor.alphaTo(100, .3, "easeOutQuad");
theTitle.alphaTo(100, .3, "easeOutQuad");
theQuote.alphaTo(100, .3, "easeOutQuad");
}
function hideQuote() {
theAuthor.alphaTo(0, .3, "easeOutQuad");
theTitle.alphaTo(0, .3, "easeOutQuad");
theQuote.alphaTo(0, .3, "easeOutQuad", 0, loadQuote);
index++;
if (index >= totalQuotes) {
index = 0;
}
}
setInterval(hideQuote, (delay*1000));
xml.load("quotes.xml");
Bookmarks