How do you unload an external jpeg image?
Complete idiot and newbie and can't figure out how to unload an external jpeg image in an AS3 function script. Any and all help will be appreciated.
var picURL2:URLRequest = new URLRequest("images/Buying-A-Diamond_Wh.jpg");
var picFrame2:Loader = new Loader();
picFrame2.load(picURL2);
function onOpen2(e:Event):void {
trace("loading has begun");
}
function onComplete2(e:Event):void {
trace("loading complete");
//caption_txt.text = "";
picFrame2.x = 200;
picFrame2.y = 155;
addChild(picFrame2);
}
function onProgress2(e:ProgressEvent):void {
trace("progress…");
var perc:Number = (e.target.bytesLoaded / e.target.bytesTotal) * 100;
}
function onError2(e:IOErrorEvent):void {
trace("error has occured");
}
function goEducationP2(e:Event):void {
trace("Education P1 next button pressed");
picFrame2.unload(picFrame2);
this.gotoAndPlay("EducationP2");
}
EducationP1Next_btn.addEventListener(MouseEvent.CLICK, goEducationP2);
picFrame2.contentLoaderInfo.addEventListener(Event.OPEN,onOpen2);
picFrame2.contentLoaderInfo.addEventListener(Event.COMPLETE,onComplete2);
picFrame2.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,onProgress2);
picFrame2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,onError2);