# Variables from external swf

**URL:** <https://forum.kirupa.com/t/variables-from-external-swf/24811>\
**Category:** Uncategorized\
**Created:** [July 5, 2003, 5:52am UTC](https://forum.kirupa.com/t/variables-from-external-swf/24811 "2003-07-05T05:52:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![paisley](https://avatars.discourse-cdn.com/v4/letter/p/a88e57/32.png) [@paisley](https://forum.kirupa.com/u/paisley)\
**Post date:** [July 5, 2003, 5:52am UTC](https://forum.kirupa.com/t/variables-from-external-swf/24811/1 "2003-07-05T05:52:54Z")

</div>

How do I call change the value of variables from an external swf. For example, in index.swf, i load the movie external.swf. External.swf has a variable ‘holder’. How do i change the value of holder from actionscript of my index.swf?

Help anybody? Thanks

---

<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:** [July 5, 2003, 9:41am UTC](https://forum.kirupa.com/t/variables-from-external-swf/24811/2 "2003-07-05T09:41:37Z")

</div>

If you put \_root. in front of the variable, the main movie will be able to change it by putting \_root. in front of the variable too. When a movieclip is loaded into another they share \_root. See [this thread](http://www.kirupaforum.com/forums/showthread.php?s=&threadid=22412) for more information.

---

<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:** [July 5, 2003, 11:04am UTC](https://forum.kirupa.com/t/variables-from-external-swf/24811/3 "2003-07-05T11:04:45Z")

</div>

Coz I’m having a problem with the fake window I made. It has a close button but the problem is I dont know where to put the actionscipting for the button.  
Say for example:

index.swf creates an empty movieclip ‘holder’.  
in ‘holder’ mc, childswf.swf is loaded which has a close button named ‘close’, then i want to close(unload) childswf.swf.

How do I call ‘close’ button? And where should I put it, in timeline of index.swf or in timeline of childswf.swf?

---

<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:** [July 5, 2003, 11:15am UTC](https://forum.kirupa.com/t/variables-from-external-swf/24811/4 "2003-07-05T11:15:58Z")

</div>

So you have a fake window with a close button on it, in an external swf, right ? Place this code on the button ‘close’ in childswf:

[AS]  
on(release){  
\_root.holder.unloadMovie();  
}  
[/AS]

That should work. For more info about the unloadMovie command, see [this page](http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary578.html)

If holder is not on the main timeline the path to it in the actionscripting will have to change accordingly.

---

<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:** [July 5, 2003, 5:54pm UTC](https://forum.kirupa.com/t/variables-from-external-swf/24811/5 "2003-07-05T17:54:38Z")

</div>

Thanks it worked!
