# If function in javascript, variable passed to Flash

**URL:** https://forum.kirupa.com/t/if-function-in-javascript-variable-passed-to-flash/176552
**Category:** flash
**Created:** [January 24, 2006, 11:24pm UTC](https://forum.kirupa.com/t/if-function-in-javascript-variable-passed-to-flash/176552 "2006-01-24T23:24:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![PaintedSwan](https://avatars.discourse-cdn.com/v4/letter/p/90db22/32.png) [@PaintedSwan](https://forum.kirupa.com/u/PaintedSwan)
#### Post date: [January 24, 2006, 11:24pm UTC](https://forum.kirupa.com/t/if-function-in-javascript-variable-passed-to-flash/176552/1 "2006-01-24T23:24:54Z")

</div>

Hello all 🙂

I’ve been doing research on this, and my issue is fairly simple, but I couldn’t find anything addressing my particular problem.

Basically I want Javascript to pass a variable to Flash according to resolution. I realize my syntax might be off, but something like:

```auto
 
<script type="text/javascript" language="javascript">
if (screen.width <= 800) {
expand = "false";
}
if (screen.width > 800) {
expand = "true";
} 
</script>

```

In the Flash file, I want to execute certain code based on whether the variable “expand” is true or false. Something to the effect of:

```auto

if (_root.expand==true) {
//do something
}else{
//do the other thing
}

```

Trouble is, I’m not sure what to do from here. I don’t know exactly what I need to put in the \<param\> and \<embed\> tags, and how Flash would detect if the variable was true or not. Any help here would be very appreciated. 🙂
