FORUMS: list search recent posts

unload a code-created shape

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
KB Brown
unload a code-created shape
on Jul 31, 2010 at 12:40:05 am

Hi, I'm trying to get a detail image to load from xml, draw a line next to the picture based upon its dimensions, and repeat this process every time another thumbnail image is selected from the grid and loaded into the detail MovieClip. Everything is going great, save one tiny problem. The line draws in the correct place, but when I load the next image, the line from the previously loaded image is still there, along with the new one for the current image. The lines just accumulate. I tried removeChild-ing the MovieClip, but that makes it so the line stops loading at all. Is there a way to clear the dimensions of all current graphics properties in the lineDrawing MovieClip either as the old image is unloaded or the new one is loaded? Here's my code, thanks for any help!

var detailImage:Loader = new Loader();
var lineDrawing:MovieClip = new MovieClip();


function setupDetail():void {
detail.visible = false;
detail.buttonMode = true;
detail.closeMessage.mouseEnabled = false;


detailImage.contentLoaderInfo.addEventListener(Event.COMPLETE, fullyLoaded);

// make sure detail is above the gallery

detail.addEventListener(MouseEvent.CLICK, onCloseDetail, false, 0, true);

function fullyLoaded(evt:Event):void {

var imgHeight:int =;
var imgWidth:int =;

var hOffset:int = imgWidth + 5 + 27;
var vOffset:int = imgHeight + 5;


if(imgWidth == 600) {,0x9a9345);,vOffset);,vOffset);
else if(imgHeight == 600) {,0x9a9345);, 1);, 599);

function onCloseDetail(evt:MouseEvent):void {
// only allow it to be closed it itas at least 90% opaque
if (detailImage.alpha>.9){
detailImage.unload();,.5, {autoAlpha:0});
detail.visible = false;

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved