# Javascript image swap - from flash

**URL:** <https://forum.kirupa.com/t/javascript-image-swap-from-flash/142667>\
**Category:** Uncategorized\
**Created:** [March 30, 2005, 5:26pm UTC](https://forum.kirupa.com/t/javascript-image-swap-from-flash/142667 "2005-03-30T17:26:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Liquideye](https://avatars.discourse-cdn.com/v4/letter/l/aeb1de/32.png) [@Liquideye](https://forum.kirupa.com/u/Liquideye)\
**Post date:** [March 30, 2005, 5:26pm UTC](https://forum.kirupa.com/t/javascript-image-swap-from-flash/142667/1 "2005-03-30T17:26:38Z")

</div>

I have the following code in my html page:

```auto
<script>
<!-- Flash image swap code

if (document.images){

img1= new Image(468,288); 
img1.src="images/_placeholder.jpg";

img2= new Image(468,288); 
img2.src="images/_placeholder_2.jpg"; 

img3= new Image(468,288); 
img3.src="images/_placeholder_3.jpg";

img4= new Image(468,288); 
img4.src="images/_placeholder_4.jpg";

}

function change(changingImage, newImage){

changingImage.src = newImage.src;

}

//-->
</script>

```

The image thats already there has an id tag “img1” a name “img1”

Then in my flash movie I have:

```auto
btn_02.onRelease = function (){ 
          getURL("javascript:change(img1, img2)"); 
}

```

But nothing happens. Clearly ive assed up something somewhere. Any Ideas?

PS,  
This is how the link should be in HTML:

```auto
<a href="#" onClick="change(img1, img2)">change to image 2</a>

```
