# Assign var and loadmovie?

**URL:** <https://forum.kirupa.com/t/assign-var-and-loadmovie/216032>\
**Category:** Uncategorized\
**Created:** [February 13, 2007, 4:32am UTC](https://forum.kirupa.com/t/assign-var-and-loadmovie/216032 "2007-02-13T04:32:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jgibz](https://avatars.discourse-cdn.com/v4/letter/j/f08c70/32.png) [@jgibz](https://forum.kirupa.com/u/jgibz)\
**Post date:** [February 13, 2007, 4:32am UTC](https://forum.kirupa.com/t/assign-var-and-loadmovie/216032/1 "2007-02-13T04:32:54Z")

</div>

[LEFT]Hi everyone,

I’m making a website that requires the main page to fade to black and then load an .swf using .loadmovie. The swf begins with black and fades out to reveal a set of buttons. This should create a seamless fade-to-black and un-fade to the loaded swf.

The problem is that there are multiple buttons presenting multiple choices on the main page, and I want each one, when clicked, to create a variable with a certian value corresponding to the button pressed. I want to use that variable in a switch statement to load the right .swf that corresponds to the button pressed on the main page.

I’m not sure if this is a syntax problem, flash seems to think my code is okay.

I put this on the first frame…

```auto
_global.yearVar = 0;
stop();

```

I put this on the button release…

```auto
on (release) 
{
    yearVar = 2006
    play();
}
         

```

After the timeline continues and fades to black I put this on the last frame…

```auto
stop();
switch (yearVar) 
{
    case yearVar == 2006 :
        location.loadMovie("2006.swf");
        break;
    
}

```

The swf won’t load. I’m new to actionscript, does anyone have any ideas?  
TIA  
btw I’m using flash mx 8  
[/LEFT]
