I'm having trouble figuring out how to make the second image for the card flip pull randomly from an external file.

var fLen:Number=400;

var picWidth:Number=105;

var picHeight:Number=142;

var isMoving:Boolean=false;

var spCard:Sprite=new Sprite();

this.addChild(spCard);

spCard.x=picWidth/2+0;

spCard.y=picHeight/2+0;

var spSide0:Sprite=new Sprite();

spCard.addChild(spSide0);

var spSide1:Sprite=new Sprite();

spCard.addChild(spSide1);

var firstSlices:Array=[];

var secondSlices:Array=[];

var sliceWidth:Number=1;

var numSlices:Number=picWidth/sliceWidth;

var bdFirst:BitmapData=new First(166,240);

var bdSecond:BitmapData=new Second(166,240);

spSide0.filters = [ new DropShadowFilter() ];

spSide1.filters = [ new DropShadowFilter() ];

var curTheta:Number=0;

cutSlices();

function cutSlices():void {

var i:int;

for(i=0;i<numSlices-1;i++){

firstSlices[i]=new Bitmap(new BitmapData(sliceWidth+1,picHeight));

firstSlices[i].bitmapData.copyPixels(bdFirst,new Rectangle(i*sliceWidth,0,sliceWidth+1,picHeight),n ew Point(0,0));

secondSlices[i]=new Bitmap(new BitmapData(sliceWidth+1,picHeight));

secondSlices[i].bitmapData.copyPixels(bdSecond,new Rectangle(i*sliceWidth,0,sliceWidth+1,picHeight),n ew Point(0,0));

spSide0.addChild(firstSlices[i]);

spSide1.addChild(secondSlices[i]);
}

firstSlices[numSlices-1]=new Bitmap(new BitmapData(sliceWidth,picHeight));

firstSlices[numSlices-1].bitmapData.copyPixels(bdFirst,new Rectangle((numSlices-1)*sliceWidth,0,sliceWidth,picHeight),new Point(0,0));

secondSlices[numSlices-1]=new Bitmap(new BitmapData(sliceWidth,picHeight));

secondSlices[numSlices-1].bitmapData.copyPixels(bdSecond,new Rectangle((numSlices-1)*sliceWidth,0,sliceWidth,picHeight),new Point(0,0));

spSide0.addChild(firstSlices[numSlices-1]);

spSide1.addChild(secondSlices[numSlices-1]);
}


renderView(curTheta);

function renderView(t:Number):void {

var j:int;

var curv0:Array=[];

var curv1:Array=[];

var curv2:Array=[];

var curv3:Array=[];

var curNormal:Number;

var factor1:Number;

var factor2:Number;

var curTransMatrix:Matrix;

t=t*Math.PI/180;

curNormal=Math.cos(t);

if(curNormal>=0){

for(j=0;j<numSlices;j++){

firstSlices[j].visible=true;

secondSlices[j].visible=false;

}

} else {

for(j=0;j<numSlices;j++){

firstSlices[j].visible=false;

secondSlices[j].visible=true;

}
}

for(j=0;j<numSlices;j++){

factor1=fLen/(fLen-Math.sin(t)*(-picWidth/2+j*sliceWidth));

factor2=fLen/(fLen-Math.sin(t)*(-picWidth/2+(j+1)*sliceWidth));

curv0=[factor1*(-picWidth/2+j*sliceWidth)*Math.cos(t),-factor1*picHeight/2];

curv1=[factor2*(-picWidth/2+(j+1)*sliceWidth)*Math.cos(t),-factor2*picHeight/2];

curv2=[factor2*(-picWidth/2+(j+1)*sliceWidth)*Math.cos(t),factor2*picHeight/2];

curv3=[factor1*(-picWidth/2+j*sliceWidth)*Math.cos(t),factor1*picHeight/2];

curTransMatrix=calcMatrixForSides(curv0,curv1,curv 2,curv3);

firstSlices[j].transform.matrix=curTransMatrix;

}

for(j=0;j<numSlices;j++){

factor1=fLen/(fLen-Math.sin(t)*(picWidth/2-j*sliceWidth));

factor2=fLen/(fLen-Math.sin(t)*(picWidth/2-(j+1)*sliceWidth));

curv0=[factor1*(picWidth/2-j*sliceWidth)*Math.cos(t),-factor1*picHeight/2];

curv1=[factor2*(picWidth/2-(j+1)*sliceWidth)*Math.cos(t),-factor2*picHeight/2];

curv2=[factor2*(picWidth/2-(j+1)*sliceWidth)*Math.cos(t),factor2*picHeight/2];

curv3=[factor1*(picWidth/2-j*sliceWidth)*Math.cos(t),factor1*picHeight/2];

curTransMatrix=calcMatrixForSides(curv0,curv1,curv 2,curv3);

secondSlices[j].transform.matrix=curTransMatrix;
}

}


function calcMatrixForSides(v0:Array,v1:Array,v2:Array,v3:A rray):Matrix {

var curMatrix:Matrix;

var transMatrix:Matrix;

var v:Array=findVecMinusVec(v1,v0);

var w:Array=findVecMinusVec(v3,v0);

curMatrix=new Matrix(v[0]/sliceWidth,v[1]/sliceWidth,w[0]/picHeight,w[1]/picHeight);

transMatrix=new Matrix(1,0,0,1,v0[0],v0[1]);

curMatrix.concat(transMatrix);

return curMatrix;

}

function findVecMinusVec(v:Array,w:Array):Array {

return [v[0]-w[0],v[1]-w[1],v[2]-w[2]];

}

var myTimer:Timer = new Timer(1000, 1);
myTimer.addEventListener(TimerEvent.TIMER_COMPLETE , timerHandler);
myTimer.start();


spSide0.addEventListener(TimerEvent.TIMER_COMPLETE , timerHandler);

function timerHandler(evt:TimerEvent):void {

if(isMoving==false){

isMoving=true;

}

}


this.addEventListener(Event.ENTER_FRAME,onEnter);

function onEnter(e:Event): void {

if(isMoving){

curTheta+=36;

curTheta=curTheta%360;

renderView(curTheta);

if((curTheta%180)==0){

isMoving=false;

}


}

}

I realize this is probably a no-brainer for most but I've spent hours racking my brain trying to incorporate random images from an external file for the original bdSecond image for the second side of the card flip.