# Assigning \_root variable from dynamic MC

**URL:** <https://forum.kirupa.com/t/assigning--root-variable-from-dynamic-mc/222249>\
**Category:** flash\
**Created:** [April 11, 2007, 11:10pm UTC](https://forum.kirupa.com/t/assigning--root-variable-from-dynamic-mc/222249 "2007-04-11T23:10:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tsj4](https://avatars.discourse-cdn.com/v4/letter/t/7ea924/32.png) [@tsj4](https://forum.kirupa.com/u/tsj4)\
**Post date:** [April 11, 2007, 11:10pm UTC](https://forum.kirupa.com/t/assigning--root-variable-from-dynamic-mc/222249/1 "2007-04-11T23:10:30Z")

</div>

Setup  
I have mc that dynamically loads in a mc onto the stage. On the last frame of the dynamic mc it tells the main timeline to advance 2 frames which then load in the next mc.

Issue  
Once all the mc’s play and the \_root movie goes back to the first frame it still continues to loop.

Question  
How do I assign a value to a var that lives on the main timeline from a dynamic mc that can also be read fromm the dynamic mc?

Here is my code:

```auto
 stop();
///////////////////////////////////////
///// Variable
///////////////////////////////////////
var vid1;
trace(vid1)
vNav.gotoAndStop(1);
loadMovie("media/vid1.swf", "vHolder"); 

```

here is the code from last frame of the Dynamically loaded MC:

```auto
 stop();
// -----
if (_root.vid1 == undefined){
_root.gotoAndPlay(3);
_root.vid1 = played;
} else if(_root.vid1 == played){
	trace ("FOO")
} 

```
