Skip to main content
Participant
February 19, 2010
Answered

How do you unload an external jpeg image?

  • February 19, 2010
  • 1 reply
  • 593 views

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);

This topic has been closed for replies.
Correct answer Ned Murphy

Try:  picFrame2.unload();

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
February 19, 2010

Try:  picFrame2.unload();

jimmy390Author
Participant
February 19, 2010

Thanks! Ned

I was trying to make a mountain out of a mole hill.

jimmy390

Ned Murphy
Legend
February 19, 2010

You're welcome