# Calling a function based on variable's value

**URL:** <https://forum.kirupa.com/t/calling-a-function-based-on-variables-value/79806>\
**Category:** Uncategorized\
**Created:** [February 17, 2005, 4:09am UTC](https://forum.kirupa.com/t/calling-a-function-based-on-variables-value/79806 "2005-02-17T04:09:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![natronp](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@natronp](https://forum.kirupa.com/u/natronp)\
**Post date:** [February 17, 2005, 4:09am UTC](https://forum.kirupa.com/t/calling-a-function-based-on-variables-value/79806/1 "2005-02-17T04:09:53Z")

</div>

say I want to declare a global variable in my main movie on a mouse event (button) and give it a value “functionA”.

then I want to load an external .swf into a clip (with the same mouse event)

then I want some code in the loaded .swf to execute a function of the same name “functionA”

how would I code this?

this way I could load the same .swf but execute different functions depending on which button triggered the load… comprende?

hope that makes sense… once I figure this out i will feel like i can actually make some stuff happen…
