No border on first image

I load my images using XML and tween them + putting a border with this script (not including the xml loading code, dont know if I need to change this?) Everything works fine with doing the same thing with all images. What I want to try to accomplish is putting no border on the first image? Anyone who can give me a hint on try to do this?


MovieClip.prototype.loadPic = function(pic) {
	this.loadMovie(pArray[pic]);
	this._parent.onEnterFrame = function() {
		var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();
		bar._visible = true;
		per = Math.round((l/t)*100);
		if (t == l && containerMC._width>0 && containerMC._height>0) {
			var w = containerMC._width, h = containerMC._height;
			border.alphaTo(100, speed_fadeIn, tweentype_fadeIn, speed_fadeIn);
			resizeMe(w, h);
			bar._visible = false;
			picInfo.text = tArray[pic];
			delete this.onEnterFrame;
		} else {
			//bar._width = w;
			bar.preInfo.text = per;
		}
	}
}

function resizeMe(w, h) {
	//border tween:
	border.tween(["_width", "_height"], [w+2, h+2], speed_resize, tweentype_resize);
	//pic and picinfo fade in:
	containerMC.alphaTo(100, speed_fadeIn, tweentype_fadeIn, speed_resize);
	picInfo.alphaTo(100, speed_fadeIn, tweentype_fadeIn, speed_fadeIn);
	//pic position:
	containerMC._x = border._x+1;
    containerMC._y = border._y+1;
}

Ok, I made an attempt on this resulting in that on the first load it reverses my intentions, image nr 1 comes up with a border and the others without!? But when I after clicking on some other image than nr 1 and comes back to nr 1 it doesn’t have a border…? I just can’t get my head around this? Anyone? Here’s how it all looks;


// Location
var main:Number = 2;
var sub:Number = 1;

//Tweentypes
var tweentype_resize:String = "easeOutExpo";
var tweentype_fadeOut:String = "easeInSine";
var tweentype_fadeIn:String = "easeInSine";

//Speed of the resizing border and the picfades
var speed_resize:Number = 0.4;
var speed_fadeOut:Number = 0.4;
var speed_fadeIn:Number = 0.4;

// buttons
function hitButton(nbrID) {
	btn = _root.nav["btn"+nbrID];
	btn.nbrID = nbrID;
	btn.onRollOver = function() {
		this.alphaTo(100, speed_fadeIn);
	};
	btn.onRollOut = function() {
		this.alphaTo(30, speed_fadeOut);
	};
	btn.onRelease = function() {
		for (var i = 1; i<15; i++) {
			_root.nav["btn"+i].alphaTo(30, speed_fadeOut);
			_root.nav["btn"+i].enabled = true;
		}
		if (i=1) {
			this.alphaTo(100, speed_fadeIn);
			this.enabled = false;
			fadeOutNoBorder(this.nbrID-1);
		} else {
		this.alphaTo(100, speed_fadeIn);
		this.enabled = false;
		fadeOut(this.nbrID-1);
		}
	}
}

for (var i = 1; i<15; i++) {
_root.hitButton(i);
}

// bildvisning
border._alpha = 0;
bar._visible = false;
containerMC._alpha = 0;
picinfo._alpha = 0;
containerMC.swapDepths(2);

MovieClip.prototype.loadPic = function(pic) {
	this.loadMovie(pArray[pic]);
	this._parent.onEnterFrame = function() {
		var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();
		bar._visible = true;
		per = Math.round((l/t)*100);
		if (t == l && containerMC._width>0 && containerMC._height>0) {
			var w = containerMC._width, h = containerMC._height;
			border.alphaTo(100, speed_fadeIn, tweentype_fadeIn, speed_fadeIn);
			resizeMe(w, h);
			bar._visible = false;
			picInfo.text = tArray[pic];
			delete this.onEnterFrame;
		} else {
			//bar._width = w;
			bar.preInfo.text = per;
		}
	}
}

MovieClip.prototype.loadPicNoBorder = function(pic) {
	this.loadMovie(pArray[pic]);
	this._parent.onEnterFrame = function() {
		var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();
		bar._visible = true;
		per = Math.round((l/t)*100);
		if (t == l && containerMC._width>0 && containerMC._height>0) {
			var w = containerMC._width, h = containerMC._height;
			border.alphaTo(100, speed_fadeIn, tweentype_fadeIn, speed_fadeIn);
			resizeMeNoBorder(w, h);
			bar._visible = false;
			picInfo.text = tArray[pic];
			delete this.onEnterFrame;
		} else {
			//bar._width = w;
			bar.preInfo.text = per;
		}
	}
}

function resizeMe(w, h) {
	//border tween:
	border.tween(["_width", "_height"], [w+2, h+2], speed_resize, tweentype_resize);
	//pic and picinfo fade in:
	containerMC.alphaTo(100, speed_fadeIn, tweentype_fadeIn, speed_resize);
	picInfo.alphaTo(100, speed_fadeIn, tweentype_fadeIn, speed_fadeIn);
	//pic position:
	containerMC._x = border._x+1;
    containerMC._y = border._y+1;
}

function resizeMeNoBorder(w, h) {
	//border tween:
	border.tween(["_width", "_height"], [w, h], speed_resize, tweentype_resize);
	//pic and picinfo fade in:
	containerMC.alphaTo(100, speed_fadeIn, tweentype_fadeIn, speed_resize);
	picInfo.alphaTo(100, speed_fadeIn, tweentype_fadeIn, speed_fadeIn);
	//pic position:
	containerMC._x = border._x;
    containerMC._y = border._y;
}

//loading CSS
var cssStyles:TextField.StyleSheet = new TextField.StyleSheet ();
cssStyles.onLoad = function (success:Boolean):Void {
        if (success) {
                picInfo.styleSheet = cssStyles;
        } else {
                picInfo.text = "Texten kunde inte laddas.";
        }
}
cssStyles.load ("styles/styles.css");

picInfo._alpha = 0;
picInfo.html = true;
picInfo.multiline = true;
picInfo.wordWrap = true;
var pArray = new Array();
var tArray = new Array();

var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function (success:Boolean):Void {
    if (success) {
		trace("success: "+this.status);
        var xmlDataNoB = this.firstChild;
			pArray.push(xmlDataNoB.childNodes[0].childNodes[0].firstChild.nodeValue);
			tArray.push(xmlDataNoB.childNodes[0].childNodes[1].firstChild.nodeValue);
				containerMC.loadPicNoBorder(0);
				picInfo.alphaTo(100, speed_fadeIn, tweentype_fadeIn, speed_fadeIn);
		var xmlData = this.firstChild;
		for (var i = 1; i<xmlData.childNodes.length; i++) {
			pArray.push(xmlData.childNodes*.childNodes[0].firstChild.nodeValue);
			tArray.push(xmlData.childNodes*.childNodes[1].firstChild.nodeValue);
        }
		// navigation
		var picNum = parseInt(i);
		for (var i = 1; i<=picNum; i++) { 
			_root.nav["btn"+i].topText_mc.text = *;
			_root.nav["btn"+i].alphaTo(30, speed_fadeIn, tweentype_fadeIn, speed_fadeIn);
			}
			_root.nav.btn1.alphaTo(100, speed_fadeIn, tweentype_fadeIn, speed_fadeIn);
			_root.nav.btn1.enabled = false;
		// load pictures
		containerMC.loadPic(0);
		picInfo.alphaTo(100, speed_fadeIn, tweentype_fadeIn, speed_fadeIn);
    } else {
        picInfo.text = "Unable to load external file.";
    }
}
myXML.load("main"+main+"/xml/sub"+sub+".xml")

//fade out pic and picinfo:
function fadeOut(pic) {
	containerMC.alphaTo(0, speed_fadeOut, tweentype_fadeOut, 0, {scope:containerMC, func:containerMC.loadPic, args:[pic]});
	picInfo.alphaTo(0, speed_fadeOut, tweentype_fadeOut);
}
function fadeOutNoBorder(pic) {
	containerMC.alphaTo(0, speed_fadeOut, tweentype_fadeOut, 0, {scope:containerMC, func:containerMC.loadPicNoBorder, args:[pic]});
	picInfo.alphaTo(0, speed_fadeOut, tweentype_fadeOut);
}