# Using varaible values in actions

**URL:** <https://forum.kirupa.com/t/using-varaible-values-in-actions/258825>\
**Category:** flash\
**Created:** [April 28, 2008, 6:07pm UTC](https://forum.kirupa.com/t/using-varaible-values-in-actions/258825 "2008-04-28T18:07:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jflint](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jflint/32/2115_2.png) [@jflint](https://forum.kirupa.com/u/jflint)\
**Post date:** [April 28, 2008, 6:07pm UTC](https://forum.kirupa.com/t/using-varaible-values-in-actions/258825/1 "2008-04-28T18:07:50Z")

</div>

I have a site that has several different loops playing in the background. I want to control them with a single sound icon.

What I was thinking of doing was setting a variable value when the sound was played - something like soundplaying=loop1.

Then, when the speaker icon is clicked to mute the sound, it would be something like this:

```auto

onRelease {
var (soundplaying value):Sound = new Sound();
    (soundplaying value).onLoad = function(success:Boolean):Void {
    if (success) {
        stopAllSounds();
        trace("Sound Loaded");
        (soundplaying value).start(0, 99);
    }
};
(soundplaying value).loadSound("loop2.mp3", false);

```

all the (soundplaying value) would be replaced with the value of the soundplaying variable.

How would I call that variable value so that it plugs into the code like this, or is it even possible?
