# AS3- Replay Button Problem

**URL:** <https://forum.kirupa.com/t/as3-replay-button-problem/323054>\
**Category:** flash\
**Created:** [June 15, 2011, 9:26am UTC](https://forum.kirupa.com/t/as3-replay-button-problem/323054 "2011-06-15T09:26:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohiniraj](https://avatars.discourse-cdn.com/v4/letter/m/67e7ee/32.png) [@mohiniraj](https://forum.kirupa.com/u/mohiniraj)\
**Post date:** [June 15, 2011, 9:26am UTC](https://forum.kirupa.com/t/as3-replay-button-problem/323054/1 "2011-06-15T09:26:00Z")

</div>

[FONT=Times New Roman][SIZE=3]

[/SIZE][/FONT]  
[SIZE=3][FONT=Times New Roman]Hello,[/FONT][/SIZE]  
[FONT=Times New Roman][SIZE=3]

[/SIZE][/FONT]  
[SIZE=3][FONT=Times New Roman]I have designed a small interactivity which has following movie clips within  
it;[/FONT][/SIZE]  
[FONT=Times New Roman][SIZE=3]

[/SIZE][/FONT]  
[SIZE=3][FONT=Times New Roman]1. images movie clip[/FONT][/SIZE]  
[FONT=Times New Roman][SIZE=3]

[/SIZE][/FONT]  
[SIZE=3][FONT=Times New Roman]2. information movie clip[/FONT][/SIZE]  
[FONT=Times New Roman][SIZE=3]

[/SIZE][/FONT]  
[SIZE=3][FONT=Times New Roman]3. next button movie clip[/FONT][/SIZE]  
[FONT=Times New Roman][SIZE=3]

[/SIZE][/FONT]  
[SIZE=3][FONT=Times New Roman]all the movie clips have 5 frames on their timeline with stop() action on  
each frame.[/FONT][/SIZE]  
[FONT=Times New Roman][SIZE=3]

[/SIZE][/FONT]  
[SIZE=3][FONT=Times New Roman]when i click on next button each movie clip gets to its next frame and at  
the end replay button gets displayed.[/FONT][/SIZE]  
[FONT=Times New Roman][SIZE=3]

[/SIZE][/FONT]  
[SIZE=3][FONT=Times New Roman]when i do click on replay button I have just added script [/FONT][/SIZE]  
[FONT=Times New Roman][SIZE=3]

[/SIZE][/FONT]  
[SIZE=3][FONT=Times New Roman]movieClipName.gotoAndStop(1);[/FONT][/SIZE]  
[FONT=Times New Roman][SIZE=3]

[/SIZE][/FONT]  
[SIZE=3][FONT=Times New Roman]for each movie clip[/FONT][/SIZE]  
[FONT=Times New Roman][SIZE=3]

[/SIZE][/FONT]  
[SIZE=3][FONT=Times New Roman]which works fine[/FONT][/SIZE]  
[FONT=Times New Roman][SIZE=3]

[/SIZE][/FONT]  
[SIZE=3][FONT=Times New Roman]but the problem is after that my next button does not work.[/FONT][/SIZE]  
[FONT=Times New Roman][SIZE=3]

[/SIZE][/FONT]  
[SIZE=3][FONT=Times New Roman]what may be the problem?[/FONT][/SIZE]  
[FONT=Times New Roman][SIZE=3]

[/SIZE][/FONT]  
[SIZE=3][FONT=Times New Roman]I have used following code;[/FONT][/SIZE]

```auto

 

 
 

 
import flash.events.MouseEvent;

 
stop();

 
information_mc.visible = false;
nextBtn_mc.visible = 
false;
images_mc.visible = false;
var session:int;
replay_btn.visible = 
false;

 
Object(this).mainScreen_mc.session01_btn.addEventListener(MouseEvent.CLICK,session01On);
Object(this).mainScreen_mc.session02_btn.addEventListener(MouseEvent.CLICK,session02On);

 

function 
session01On(e:MouseEvent):void
{
 Object(root).information_mc.visible 
= true;
 Object(root).nextBtn_mc.visible = 
true;
 Object(root).nextBtn_mc.nextFrame_btn.enabled = 
true;
 Object(root).images_mc.visible = true;
 
 session 
= 1;
 
}

 
nextBtn_mc.nextFrame_btn.addEventListener(MouseEvent.CLICK,goToNextFrame);
function 
goToNextFrame(e:MouseEvent):void
{
 if (session == 
2)
 {
  Object(root).information_mc.nextFrame();
  Object(root).nextBtn_mc.nextFrame();
  Object(root).images_mc.nextFrame();
  
  Object(root).information_mc.visible 
= 
false;
  
 }
 else
 {
  Object(root).information_mc.nextFrame();
  Object(root).nextBtn_mc.nextFrame();
  Object(root).images_mc.nextFrame();
  
 }

 
}

 

function 
session02On(e:MouseEvent):void
{
 
 Object(root).nextBtn_mc.visible 
= true;
 Object(root).images_mc.visible = true;
 session = 
2;
}

 

replay_btn..addEventListener(MouseEvent.CLICK,resetAll);
function 
resetAll(e:MouseEvent):void
{
 Object(this).information_mc.gotoAndStop(1);
 information_mc.visible 
= 
false;
 ////////////////
 Object(this).nextBtn_mc.gotoAndStop(1);
 nextBtn_mc.visible 
= 
false;
 ////////////////
 Object(this).images_mc.gotoAndStop(1);
 images_mc.visible 
= false;
 //////////////
 replay_btn.visible = false;
}

```
