# Passing parameters to .swf through URL

**URL:** <https://forum.kirupa.com/t/passing-parameters-to-swf-through-url/293386>\
**Category:** flash\
**Created:** [July 28, 2009, 10:03am UTC](https://forum.kirupa.com/t/passing-parameters-to-swf-through-url/293386 "2009-07-28T10:03:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gitanjali](https://avatars.discourse-cdn.com/v4/letter/g/858c86/32.png) [@gitanjali](https://forum.kirupa.com/u/gitanjali)\
**Post date:** [July 28, 2009, 10:03am UTC](https://forum.kirupa.com/t/passing-parameters-to-swf-through-url/293386/1 "2009-07-28T10:03:25Z")

</div>

I am trying to pass parameters to my .swf generated like this:

file:///C:/Documents%20and%20Settings/admin/Desktop/flash/comm\_law/Dominoes.swf?n1=4

And have included the following code in my document class.

private var n1:int = getSWFParam(n1,5);  
protected function getSWFParam(num:int, defaultValue:int):int  
{  
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;  
if(paramObj[num] != 0)  
return paramObj[num];  
else  
return defaultValue;  
}

But somehow the code is executing assuming a value of n1=2, although I have not assigned n1 as 2 anywhere. Where am I going wrong?
