# Passing vars to flash

**URL:** <https://forum.kirupa.com/t/passing-vars-to-flash/285554>\
**Category:** Uncategorized\
**Created:** [April 2, 2009, 8:05am UTC](https://forum.kirupa.com/t/passing-vars-to-flash/285554 "2009-04-02T08:05:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![utzelbrutz](https://avatars.discourse-cdn.com/v4/letter/u/eb9ed0/32.png) [@utzelbrutz](https://forum.kirupa.com/u/utzelbrutz)\
**Post date:** [April 2, 2009, 8:05am UTC](https://forum.kirupa.com/t/passing-vars-to-flash/285554/1 "2009-04-02T08:05:46Z")

</div>

Hello, got a great problem.

I have to pass some variables to the flash movie (movie.swf?var1=aaa&var2=bbb). never had a problem with using them before.

I’ve read around a lot an tried different coding, but when I export the swf I got the error, that root is unknown…

doesn’t matter, if I use one of this

var flashvars:Object = root.loaderInfo.parameters;  
var flashvars:Object = stage.loaderInfo.parameters; // stage is unknown here…  
var flashvars:Object = MovieClip(root).loaderInfo.parameters;  
var flashvars:Object = MovieClip(root.loaderInfo).parameters;  
var flashvars:Object = LoaderInfo(root.loaderInfo).parameters;  
and also using directly as  
var test:String = root.loaderInfo.parameters.var1;

- it’s placed in a public static function
- that’s placed in a class which extends movieclip
- that’s placed in a package which imports events._, display._ and net.\*

thx for help…

using: cs4
