# Auto Unload of External Image

**URL:** <https://forum.kirupa.com/t/auto-unload-of-external-image/317281>\
**Category:** flash\
**Created:** [December 15, 2010, 7:18pm UTC](https://forum.kirupa.com/t/auto-unload-of-external-image/317281 "2010-12-15T19:18:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![d\_bezhanski](https://avatars.discourse-cdn.com/v4/letter/d/e9bcb4/32.png) [@d\_bezhanski](https://forum.kirupa.com/u/d_bezhanski)\
**Post date:** [December 15, 2010, 7:18pm UTC](https://forum.kirupa.com/t/auto-unload-of-external-image/317281/1 "2010-12-15T19:18:47Z")

</div>

Hi All,  
I’m absolutely new with ActionScript 3.0, but however, i have to make a script with three steps.

1. CountDown
2. TouchCounter
3. ImageLoader + Auto ImageUnloader

I made the first two and the third in some part.

var TouchCounter:uint = 0;  
touch\_button.addEventListener(MouseEvent.CLICK, Toucher);  
function Toucher(event:MouseEvent):void  
{  
TouchCounter += 1;  
count\_txt.text = String(TouchCounter);  
}  
var ExternalIMG1:URLRequest = new URLRequest(“ONE\_LINE.JPG”);  
var ExternalIMG2:URLRequest = new URLRequest(“ATOMIC.JPG”);  
var myLoader1:Loader = new Loader();  
touch\_button.addEventListener(MouseEvent.CLICK, Counter);  
myLoader1.contentLoaderInfo.addEventListener(Event .COMPLETE, ImageShow);  
function Counter(event:MouseEvent):void  
{  
if(TouchCounter==5)  
{  
myLoader1.load(ExternalIMG1);  
}  
}  
function ImageShow(event:Event):void  
{  
addChild(myLoader1);  
myLoader1.x = 0  
myLoader1.y = 135  
}

Everytime i touch a Button, named touch\_button, it counts +1. On every count i need to display one external Image, witch must be automatically unloaded after 2 seconds. Coz my script for this unload is too stupid i will not share it, but i tried almost everything.  
On fifth Touch i need to load a second Image and i load it ![](http://forum.kirupa.com/uploads/kirupa/798/c985a958819d8917.gif) It needs to stay on display forever and it stays. After then i have to continue counting and loading and unloading after 2 seconds of first image.

I’ll be very thankful, if you halp me, because i tried for 5 days and nothing happend!
