# Using a variable in a URL Request

**URL:** <https://forum.kirupa.com/t/using-a-variable-in-a-url-request/285144>\
**Category:** flash\
**Created:** [March 27, 2009, 3:07pm UTC](https://forum.kirupa.com/t/using-a-variable-in-a-url-request/285144 "2009-03-27T15:07:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ricky55](https://avatars.discourse-cdn.com/v4/letter/r/2bfe46/32.png) [@Ricky55](https://forum.kirupa.com/u/Ricky55)\
**Post date:** [March 27, 2009, 3:07pm UTC](https://forum.kirupa.com/t/using-a-variable-in-a-url-request/285144/1 "2009-03-27T15:07:03Z")

</div>

In AS2 to create a URL that would change depending on the current movie being viewed I would create variable and use this to make up the path, I can’t get this working in AS3, what do I need to do to make this work?

I have

```auto

var fileReq3:URLRequest=new URLRequest(currentPath);

var currentPath:String = "mainImages/imageA.jpg";

```

Then on my buttons I want to just reset the currentPath to image a b c and so on.

When I publish my swf I get an error #2007 parameter must not be null.

Any advice would be much appreciated.

Thanks

Ricky
