# Loading vars straight from a url

**URL:** <https://forum.kirupa.com/t/loading-vars-straight-from-a-url/8785>\
**Category:** Uncategorized\
**Created:** [November 28, 2002, 3:17pm UTC](https://forum.kirupa.com/t/loading-vars-straight-from-a-url/8785 "2002-11-28T15:17:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![j0se](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/j0se/32/44_2.png) [@j0se](https://forum.kirupa.com/u/j0se)\
**Post date:** [November 28, 2002, 3:17pm UTC](https://forum.kirupa.com/t/loading-vars-straight-from-a-url/8785/1 "2002-11-28T15:17:19Z")

</div>

i’m trying to read in the URL displayed in flash

if i do this:

url=this.\_url;

i get:

[http://domain.com/myFlashMovie.swf](http://domain.com/myFlashMovie.swf)

but i what i actually want is:

[http://domain.com/myFlashMovie.htm](http://domain.com/myFlashMovie.htm)

plus whatever i pass through the URL

e.g.

[http://domain.com/myFlashMovie.htm?canUCme](http://domain.com/myFlashMovie.htm?canUCme)

help is appreciated  
🙂

---

<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:** [December 3, 2002, 1:52pm UTC](https://forum.kirupa.com/t/loading-vars-straight-from-a-url/8785/2 "2002-12-03T13:52:07Z")

</div>

in case anybody needs to do this @ some point, i’ll share how i finally did it:

don’t sleep (you forget stuff)  
drink coffee (keeps you awake)

=)

i did it using javascript, because it’s most browsers’ default language and i don’t have a php/mysql/asp etc enabled server (and if i did, i wouldn’t know how to use it)

====  
1 place an input textbox on our main timeline (don’t place it inside a movieclip because it won’t work this way and i don’t know if you can send variables to a movieclip inside an swf, but if you can i imagine it’ll cost you another week’s sleep)

2 attach a variable to the input box (e.g. varInput)

and that’s it (no loadVars functions needed). save your file and insert it into an html document

3 add some javascript (file attached)

and upload  
=)

you can then pass variables in the http header like this:

[www.domain.com?varInput=hello](http://www.domain.com?varInput=hello)  
(varInput is the name of the input textbox in your swf)

===

NOTES: if you haven’t used javascript before (like me) it can be a nightmare to integrate. don’t miss anything out (all the ’ signs count --\> i originally missed them thinking they were there for commenting purposes)

the function that works out the http variables from rest of the string and passes it to the swf is: document.location.search (if you have a javascript book handy i’m sure it’ll be documented there - or if you’re luckier than me you might find a useful tutotrial on the net)

good luck
