GA was able to track the page when click on image contents, however, it failed to track which image content was clicked on. Notice any code errs or suggestions?:
AS:
import flash.external.*;
function trackGA(action:String) {
ExternalInterface.call("pageTracker._trackPageview('/pageTracker/IntegrateGoogleAnalytics/"+action+"')");
}
var delay:Number = 4000;
var init:Boolean = false;
var top:MovieClip = picture;
var bot:MovieClip = picture2;
//-----------------------
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
link = [];
trackad = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
link* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
trackad* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("test.xml");
p = 0;
function fadeIn() {
//swap();
onEnterFrame = function() {
filesize = top.getBytesTotal();
loaded = top.getBytesLoaded();
if (loaded != filesize) {
preloader._visible = false;
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
top.onRelease = function():Void
{
trackGA(trackad[p]);
getURL(link[p], "_blank");
};
if (top._alpha < 100) {
top._alpha +=5;
} else {
delete onEnterFrame;
slideshow();
}
}
};
};
function fadeOut() {
onEnterFrame = function() {
if (top._alpha > 5) {
top._alpha -=5;
}else{
top._alpha = 0;
delete onEnterFrame;
nextImage();
}
};
};
function nextImage() {
if (p<(total-1)) {
p++;
top._alpha = 0;
top.loadMovie(image[p]);
fadeIn();
}
};
function firstImage() {
init = true;
top._alpha = 0;
top.loadMovie(image[0]);
fadeIn();
};
function slideshow() {
myInterval = setInterval(pause_slideshow, delay);
function pause_slideshow() {
clearInterval(myInterval);
if (p == (total-1) && !init) {
p = 0;
firstImage();
} else if (p == (total-1) && init) {
p = -1;
swap();
}else{
swap();
}
}
};
function swap(){
var t = top;
top.swapDepths(bot);
top = bot;
bot = t;
nextImage();
}