SOLVED! Thanks and God bless, BenBart.
Hello, all. This should be easy.
I’ve got a file upload (for art) function on my application that works…but whenever you load a .jpg or .png file into the designnated movie clip (chip_clip) then upload another the original file isn’t cleared out and they’re meshed atop one another. I just want to be able to have any existing file in “chip_clip” unloaded and replaced by any new one.
“Browse” is the button which calls this function. Thanks in advance for any advice:
var file:FileReference = new FileReference();
file.addEventListener(Event.SELECT, fileSelect);
file.addEventListener(Event.COMPLETE, fileComplete);
var loader:Loader = new Loader();
browse.addEventListener(MouseEvent.MOUSE_DOWN,function(){
loader.unloadAndStop();
});
browse.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
function mouseDown(event:MouseEvent)
{
file.browse();
}
function fileSelect(event:Event)
{
file.load();
}
function fileComplete(event:Event)
{
//var loader:Loader = new Loader();
loader.loadBytes(file.data);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
}
function onCompleteHandler(event:Event):void
{
chip_clip.addChild(event.target.content);
event.target.content.width = 90;
event.target.content.scaleY = event.target.content.scaleX;
}