# Can anyone please help me with this script?

**URL:** <https://forum.kirupa.com/t/can-anyone-please-help-me-with-this-script/226107>\
**Category:** flash\
**Created:** [May 18, 2007, 5:05am UTC](https://forum.kirupa.com/t/can-anyone-please-help-me-with-this-script/226107 "2007-05-18T05:05:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![agentparas](https://avatars.discourse-cdn.com/v4/letter/a/b5e925/32.png) [@agentparas](https://forum.kirupa.com/u/agentparas)\
**Post date:** [May 18, 2007, 5:05am UTC](https://forum.kirupa.com/t/can-anyone-please-help-me-with-this-script/226107/1 "2007-05-18T05:05:56Z")

</div>

Hi There  
I am a newbie ActionScripter and have run into an impasse in a project I am working on. I hope that one of you Super Coders out there can help me with this problem. I am all about trying to figure out the whole mechanics of the thing but I am basically resorting to shots in the dark now. Can anyone out there help? I would greatly appreciate it.  
Thanks.

The story so far…

Basically I am trying to make a movie clip viewer that plays series of loaded swfs on the main stage Normally I would just make a series of keyframes but I was trying to ultimately streamline the process should down the road I need to show a bunch of swfs and would rather not have to make a bazillion keyframes and then have a frame in the middle of everything screw up. I would just like to change the total number of loaded movies dynamically.

I have a nav bar that has three buttons (“play\_mc”, “back2\_mc” and “replay\_mc”) and a dynamic text field (“showCount\_txt”) that indicates what “frame.swf” you are viewing out of a total number (ie 1/5, 2/5, 3/5 etc)

Now with the buttons I would like the following to happen:  
each button either loads and unloads a swf into an empty clip on the stage named “container\_1\_mc”  
changes the number in the “showCount\_txt” dynamic text box  
changes the name of the next swf to be loaded into the “container\_1\_mc”  
turns itself off if not needed (like the play button turns off when it reaches the last swf)

In order to accomplish this task I assigned the following actions to the buttons (or at least think I did since the script doesn’t work)

The Cast of Characters:

play\_mc (plays the next movie)  
unloads the current swf in the container clip  
changes the showCount\_txt by 1  
makes the “back2\_mc” active  
makes the “replay\_mc” active  
changes the title of the loaded swf  
loads the next renamed swf into the “container\_1\_mc”  
goes inactive after the total amount of swfs have played

back2\_mc (plays the previous movie)  
unloads the current swf in the container clip  
subtracts 1 from the showCount\_txt  
changes the title of the loaded swf to that of the previous one  
loads the renamed swf into the “container\_1\_mc”  
goes inactive after the very first swf is loaded

replay\_mc (goes back to the first movie)  
unloads the current swf in the container clip  
resets the showCount\_txt  
loads the first swf  
turns off the back2\_mc  
then goes inactive

The Problem:  
I kind of suck at this…and  
Neither the Back button or the Replay button work.  
When things “reset” the buttons stop working and won’t make the text box change or rename the swf. Somehow I suspect turning the buttons on and off has something to do with it but I’m at a loss to understand why.

and this what I wrote to make the magic happens… (or NOT HAPPEN as is the case)

first frame:

stop();  
var frameNum = 1;  
// total number of frames  
var totalNum = 5;  
\_root.play\_mc.gotoAndStop(“on”);  
\_root.showCount\_txt.text = frameNum+" / "+totalNum;  
container\_1\_mc.loadMovie(“frame1.swf”);

\_root.play\_mc.next\_btn.onRelease = function() {  
\_root.back2\_mc.gotoAndStop(“on”);  
\_root.replay\_mc.gotoAndStop(“on”);  
container\_1\_mc.unLoadMovie();  
frameNum++;  
if (frameNum == totalNum) {  
\_root.play\_mc.gotoAndStop(“off”);  
}  
\_root.showCount\_txt.text = frameNum+" / “+totalNum;  
container\_1\_mc.loadMovie(“frame”+frameNum+”.swf");  
};  
\_root.back2\_mc.next\_btn.onRelease = function() {  
container\_1\_mc.unLoadMovie();  
frameNum–;  
if (frameNum == 1) {  
\_root.back2\_mc.gotoAndStop(“off”);  
\_root.play\_mc.gotoAndStop(“on”);  
}  
\_root.showCount\_txt.text = frameNum+" / “+totalNum;  
container\_1\_mc.loadMovie(“frame”+frameNum+”.swf");  
};  
\_root.replay\_mc.onRelease = function() {  
container\_1\_mc.unLoadMovie();  
container\_1\_mc.loadMovie(“frame1.swf”);  
};
