# Load Movie/store Movie Name In Variable

**URL:** <https://forum.kirupa.com/t/load-movie-store-movie-name-in-variable/277353>\
**Category:** flash\
**Created:** [December 11, 2008, 2:34am UTC](https://forum.kirupa.com/t/load-movie-store-movie-name-in-variable/277353 "2008-12-11T02:34:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xFlashStudentx](https://avatars.discourse-cdn.com/v4/letter/x/57b2e6/32.png) [@xFlashStudentx](https://forum.kirupa.com/u/xFlashStudentx)\
**Post date:** [December 11, 2008, 2:34am UTC](https://forum.kirupa.com/t/load-movie-store-movie-name-in-variable/277353/1 "2008-12-11T02:34:50Z")

</div>

Good evening Flash men. Uhm, I’m using Flash CS4 and I’m trying setup my fla this way: I want to load different movies with several buttons, and I want to code the buttons in a way that will get the name of the movie to load from a variable. More emphatically, I want to create a variable name lastLoaded to store what was the last movie loaded into the main movie.

Here is what I got thus far:

var my\_loader:Loader = new Loader();  
addChild(my\_loader);

var lastLoaded:String;

myVideos.addEventListener(MouseEvent.MOUSE\_DOWN, loadTheBaby);  
myCars.addEventListener(MouseEvent.MOUSE\_DOWN, loadTheCars);

function loadTheBaby (e:MouseEvent):void{

my\_loader.load(new URLRequest(“lastLoaded+.swf”));  
lastLoaded=“myVideos”;  
}  
function loadTheCars(){  
my\_loader.load(new URLRequest(“lastLoaded+.swf”));  
lastLoaded=“myCars”;  
}

Here’s the error message i’m getting:

1120: Access of undefined property myVideos.  
1120: Access of undefined property myCars.

So,clearly, whenever a button is clicked, I want the the name of that button/movie TO BE stored in the variable lastLoaded and I also need the specific movie to load. I need to code it this way because I’m making my own transition animation and not the unattractive ones that Adobe provided. Any assistance will be immensely appreciated…Thank you…
