# Help with passing a variable to Flash. SWFObject maybe, not sure

**URL:** <https://forum.kirupa.com/t/help-with-passing-a-variable-to-flash-swfobject-maybe-not-sure/326112>\
**Category:** flash\
**Created:** [November 23, 2011, 1:19pm UTC](https://forum.kirupa.com/t/help-with-passing-a-variable-to-flash-swfobject-maybe-not-sure/326112 "2011-11-23T13:19:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![m2244](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@m2244](https://forum.kirupa.com/u/m2244)\
**Post date:** [November 23, 2011, 1:19pm UTC](https://forum.kirupa.com/t/help-with-passing-a-variable-to-flash-swfobject-maybe-not-sure/326112/1 "2011-11-23T13:19:35Z")

</div>

Hello,

I am trying to place a SWF on a page and pass a variable to it. The variable would depend on which link that the user clicked on. I am toggling the visibility of the div containing the SWF (code at the bottom). What I need to do is, when I toggle the div ‘on’ I need to pass a variable to the SWF so that it knows which file to load. Would I use SWFObject for this?

Here is the HTML code on the page.

```auto

	<a class="popUpLink" href="#" onclick="showHidePUP();">Trojan Horse</a>
	
	<div id="boxPup" class="box" style="left:225px;top:75px;"><!--style="left:400px;top:150px;-->
		<div class="bar" onmousedown="dragStart(event, 'boxPup')">Drag Box B</div>
		<div>
			<object id="notUsedId" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="700px" height="550px" align="middle">
					<param name="allowScriptAccess" value="always" />
					<param name="allowFullScreen" value="false" />
					<param name="wmode" value="transparent" />
					<param name="movie" value="pop_up.swf" />
					<param name="quality" value="high" />
					<param name="scale" value="noscale" />
					<param name="salign" value="lt" />
					<param name="bgcolor" value="#ffffff" />
					<embed src="pop_up.swf" quality="high" scale="noscale" salign="lt" bgcolor="#ffffff" width="100%" height="100%" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" />
			</object>
		</div>
	</div>

```

Here is the toggle function

```auto

function showHidePUP()
{
	$('#boxPup').toggle();
}

```
