# Dynamic Scene Change

**URL:** <https://forum.kirupa.com/t/dynamic-scene-change/258620>\
**Category:** flash\
**Created:** [April 25, 2008, 7:14pm UTC](https://forum.kirupa.com/t/dynamic-scene-change/258620 "2008-04-25T19:14:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wjaspers](https://avatars.discourse-cdn.com/v4/letter/w/e19b73/32.png) [@wjaspers](https://forum.kirupa.com/u/wjaspers)\
**Post date:** [April 25, 2008, 7:14pm UTC](https://forum.kirupa.com/t/dynamic-scene-change/258620/1 "2008-04-25T19:14:08Z")

</div>

I’m using a MovieClip to hold several buttons; which, when pressed should cause the \_root element to change the scene to a specific scene.

The problem I am encountering however, is that

```auto

gotoAndPlay( scene:String, frame:Object):Void 

```

doesn’t seem to allow me to utilize a String variable  
in leui of a phsyical string (i.e. var myvar = “hello”);

**is there any way around this?**

attached is the movieClip’s (internal) code (which resides on an empty layer named ‘Functions’):

```auto

var sceneName:String = new String("");

function SetSceneName( sceneName:String ):Void
{
    this.sceneName = sceneName;
}

function GetSceneName():String
{
    return sceneName;
}

```

each button within this movieClip calls:

```auto

on ( release )
{
   _root.gotoAndPlay( _parent.GetSceneName(), 1 );
}

```

but the error i continue to get is of no help.
