Statement must appear within on/onClipEvent handler

Hi Guys, I’m creating a site with a vertical scroll xml photo gallery. When i run it I get the following errors would anyone be able to help

Error Scene=Scene 1, layer=preloader, frame=1:Line 2: Statement must appear within on/onClipEvent handler
function loadXML(loaded){
Error Scene=Scene 1, layer=preloader, frame=1:Line 20: Statement must appear within on/onClipEvent handler
xmlData = new XML();
Error Scene=Scene 1, layer=preloader, frame=1:Line 21: Statement must appear within on/onClipEvent handler
xmlData.ignoreWhite = true;
Error Scene=Scene 1, layer=preloader, frame=1:Line 22: Statement must appear within on/onClipEvent handler
xmlData.onLoad = loadXML;
Error Scene=Scene 1, layer=preloader, frame=1:Line 23: Statement must appear within on/onClipEvent handler
xmlData.load(“images.xml”);
Error Scene=Scene 1, layer=preloader, frame=1:Line 26: Statement must appear within on/onClipEvent handler
previous_btn.onRelease = function(){
Error Scene=Scene 1, layer=preloader, frame=1:Line 29: Statement must appear within on/onClipEvent handler
next_btn.onRelease = function (){
Error Scene=Scene 1, layer=preloader, frame=1:Line 34: Statement must appear within on/onClipEvent handler
p=0
Error Scene=Scene 1, layer=preloader, frame=1:Line 35: Statement must appear within on/onClipEvent handler
this.onEnterFrame = function(){
Error Scene=Scene 1, layer=preloader, frame=1:Line 48: Statement must appear within on/onClipEvent handler
function nextImage(){
Error Scene=Scene 1, layer=preloader, frame=1:Line 59: Statement must appear within on/onClipEvent handler
function prevImage(){
Error Scene=Scene 1, layer=preloader, frame=1:Line 68: Statement must appear within on/onClipEvent handler
function firstImage(){
Error Scene=Scene 1, layer=preloader, frame=1:Line 76: Statement must appear within on/onClipEvent handler
function picture_num(){

My Code is

function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = ;
description = ;
thumbnails = ;
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
thumbnails* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
thumbnails_fn(i);
}
firstImage();
} else {
content = “file not loaded!”;
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(“images.xml”);
//Preloader
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
};
//nextimage function
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
}
//Previous Image funtion
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[1], 1);
desc_txt.text = description[0];
picture_num();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
function thumbNailScroller() {

this.createEmptyMovieClip("tscroller", 1000);
scroll_speed = 7;
tscroller.onEnterFrame = function() {
    if ((_root._xmouse &gt;= thumbnail_mc._x ) && (_root._xmouse &lt;= thumbnail_mc._x + thumbnail_mc._width)) {
        if ((_root._ymouse&gt;=(hit_down._y - 20)) && (thumbnail_mc.hitTest(hit_down))) {
            thumbnail_mc._y -= scroll_speed;
        } else if ((_root._ymouse&lt;= 120) && (thumbnail_mc.hitTest(hit_up))) {
            thumbnail_mc._y += scroll_speed;
        }
    } else {
        delete tscroller.onEnterFrame;
    }
};

}
function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip(“t”+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._y =(target_mc._height + 2)*k;
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
};
target_mc.onRollOver = function() {
this._alpha = 50;
thumbNailScroller();
};
target_mc.onRollOut = function() {
this._alpha = 100;
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], “thumbnail_mc.t”+k);
}

It would be awesome if someone could help me out thanks:p: