# Adjusting an AS2 code, to change scene

**URL:** <https://forum.kirupa.com/t/adjusting-an-as2-code-to-change-scene/305647>\
**Category:** flash\
**Created:** [March 1, 2010, 10:43am UTC](https://forum.kirupa.com/t/adjusting-an-as2-code-to-change-scene/305647 "2010-03-01T10:43:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mayurrenr](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@mayurrenr](https://forum.kirupa.com/u/mayurrenr)\
**Post date:** [March 1, 2010, 10:43am UTC](https://forum.kirupa.com/t/adjusting-an-as2-code-to-change-scene/305647/1 "2010-03-01T10:43:39Z")

</div>

Hi everyone, please see the following AS2 code taken from this tutorial, [http://www.swinburne.edu.au/design/tutorials/P-flash/T-How-to-drag-and-drop-in-Flash/ID-37/](http://www.swinburne.edu.au/design/tutorials/P-flash/T-How-to-drag-and-drop-in-Flash/ID-37/), and adjusted to my flash animation:

```auto
drug.onPress = function() {
startDrag(this);
};
drug.onRelease = drug.onReleaseOutside=function () {
stopDrag();
if (this._droptarget == "/IonChannel") {
this.onTarget = true;
_root.IonChannel.gotoAndStop(2);
} else {
this.onTarget = false;
_root.IonChannel.gotoAndStop(1);
}
};
//the variables below will store the clips starting position
drug.myHomeX=drug._x;
drug.myHomeY=drug._y;
//the variables below will store the clips end position
drug.myFinalX = IonChannel._x;
drug.myFinalY = IonChannel._y;
drug.onMouseDown = function() {
//this variable tells us if the mouse is up or down
mousePressed = true;
};
drug.onMouseUp = function() {
mousePressed = false;
};
drug.onEnterFrame = function() {
//all these actions basically just say "if the mouse is up (in other words - the clip is not being dragged)
// then move the MC back to its original starting point (with a smooth motion)"
if (mousePressed == false && this.onTarget == false) {
this._x -= (this._x-this.myHomeX)/5;
this._y -= (this._y-this.myHomeY)/5;
}
};

```

All that ive changed from the tutorial to above are the names of the objects (ie _circle\_mc_ --\> _drug_ AND _targetCircle_ --\> _IonChannel_). What I would like to do is edit the code above so that it goes to a different scene at the first frame. My initial thought was to change:

```auto
_root.IonChannel.gotoAndStop(2);

```

to

```auto
gotoAndPlay(Scene2, 1)

```

But for some reason, this did not work. Does anybody have any tips/pointers to fix this problem?

Thanks to everyone who helps.
