# Variables and flash?

**URL:** <https://forum.kirupa.com/t/variables-and-flash/102636>\
**Category:** Uncategorized\
**Created:** [February 25, 2004, 5:02pm UTC](https://forum.kirupa.com/t/variables-and-flash/102636 "2004-02-25T17:02:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bleutuna](https://avatars.discourse-cdn.com/v4/letter/b/eada6e/32.png) [@bleutuna](https://forum.kirupa.com/u/bleutuna)\
**Post date:** [February 25, 2004, 5:02pm UTC](https://forum.kirupa.com/t/variables-and-flash/102636/1 "2004-02-25T17:02:54Z")

</div>

Got a website. Has some music. I want to make it so that if you turn the music off, it says off on subsequent pages.

The site is HTML, with flash where needed.

[http://www.aladdin-trading.com/dev/](http://www.aladdin-trading.com/dev/)

Can I use flash to write a variable to ASP, and then have ASP pass it back to Flash?

---

<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:** [February 25, 2004, 6:36pm UTC](https://forum.kirupa.com/t/variables-and-flash/102636/2 "2004-02-25T18:36:40Z")

</div>

In short, yes.

There are a number of methods you can use to synchronize your flash movie to a back-end, including Flash Remoting, XML and send/load vars. Here’s some example code (from the O’Reilly “Flash Cookbook” - buy it!) for loading vars from a server-side cgi script.

```auto

// You must first create the LoadVars object.
myLoadVars = new LoadVars( );

// Then load the variable from the server-side script. This example 
// uses the loadVarsScript.cgi script, which is assumed to be in 
// the /cgi-bin directory on the same server. To test this code, 
// change the URL to point to an actual script on your server.
myLoadVars.load("/cgi-bin/loadVarsScript.cgi");

myLoadVars.onLoad = function (success) {
  // If the data loads, display the variable in a 
  // text field named output_txt on _root.
  if (success) {
    _root.output_txt.text = this.myVar;
  }
};

```

Instead of CGI, those vars could be loaded from an ASP page as well…
