# Problem with loading a random swf. into a target

**URL:** https://forum.kirupa.com/t/problem-with-loading-a-random-swf-into-a-target/27527
**Category:** flash
**Created:** [August 3, 2003, 6:23pm UTC](https://forum.kirupa.com/t/problem-with-loading-a-random-swf-into-a-target/27527 "2003-08-03T18:23:51Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![bubba1](https://avatars.discourse-cdn.com/v4/letter/b/b3f665/32.png) [@bubba1](https://forum.kirupa.com/u/bubba1)
#### Post date: [August 3, 2003, 6:23pm UTC](https://forum.kirupa.com/t/problem-with-loading-a-random-swf-into-a-target/27527/1 "2003-08-03T18:23:51Z")

</div>

Hello,  
I am trying to load 1 of 4 swf. files randomly into a holder on a home page.

the code I’m using doesn’t work.  
here is the actionScript:

loadMovie(“image” add random(3) + 1 add “.swf”, “\_root.holder1”)  
stop();

my swf files are named:  
image1.swf  
image2.swf  
image3.swf  
image4.swf

when I test the movie I get an error message that it can’t find the movie.  
As an example, the code is adding a 1  
to the name of the swf.  
image11.swf

Any insight would be greatly appreciated,  
thx

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 3, 2003, 6:31pm UTC](https://forum.kirupa.com/t/problem-with-loading-a-random-swf-into-a-target/27527/2 "2003-08-03T18:31:46Z")

</div>

[AS]loadMovie(“image”+(Math.floor(Math.random()\*4)+1)+".swf","\_root.holder1");[/AS]

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 3, 2003, 6:38pm UTC](https://forum.kirupa.com/t/problem-with-loading-a-random-swf-into-a-target/27527/3 "2003-08-03T18:38:51Z")

</div>

claudio,  
It works! Thank you so much for your help.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 3, 2003, 6:41pm UTC](https://forum.kirupa.com/t/problem-with-loading-a-random-swf-into-a-target/27527/4 "2003-08-03T18:41:00Z")

</div>

No problem 😉
