# How to use correct external path for so.addVariable

**URL:** <https://forum.kirupa.com/t/how-to-use-correct-external-path-for-so-addvariable/239749>\
**Category:** Uncategorized\
**Created:** [September 25, 2007, 3:51pm UTC](https://forum.kirupa.com/t/how-to-use-correct-external-path-for-so-addvariable/239749 "2007-09-25T15:51:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![scriptrookie](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@scriptrookie](https://forum.kirupa.com/u/scriptrookie)\
**Post date:** [September 25, 2007, 3:51pm UTC](https://forum.kirupa.com/t/how-to-use-correct-external-path-for-so-addvariable/239749/1 "2007-09-25T15:51:33Z")

</div>

hi everyone,

i was trying to load an dynamic swf by an external path using the addVariable of swfObject. But i seem to be lost when im already trying to call the path of the swf. on the loadMovie function, i noticed that “\_level0.bg” which is a String and myRandom as Number is not possible to concatenate. Can I ask anyone how to be able to call this path properly so that i can load the swf?

Anyone’s suggestion is greatly appreciated. I attached the code here so anyone can see what i’ve done wrong in the code.

```auto
 
_root.onLoad = function() {
 var myRandom = Math.floor(Math.random() * _level0.totalPic) + 1;
 _root.bg_mc.loadMovie("_level0.bg" + myRandom); // it should be like _level0.bg1;
}

```

```auto

<script type="text/javascript">
   var so = new SWFObject("core.swf", "mymovie", "764", "500", "8", "#FFFFFF");
   so.addParam("wmode", "window");
   so.addParam("salign", "t");
   so.addParam("scale", "noscale");
  so.addVariable("totalPic", "21");
  so.addVariable("bg1", "bg/1.swf");
  so.addVariable("bg2", "bg/2.swf");
  so.addVariable("bg3", "bg/3.swf");
  so.write("flashcontent");
</script>

```

cheers,  
\_scriptRookie
