If/Else statement that may or may not be the solution I should be using

Hi folks, I’m new to AS3 and even newer to Kirupa, but I’m hoping being here will help me solve some of my programming problems.

I’m really not a programmer, just a designer who’s using Flash for primarily visual enhancements on webpages. I’m really not trying to do anything crazy with the code, and I suspect that most of what I’m trying to do could be accomplished through rather convoluted timeline animations, but I want to do things right and I know that means accomplishing as much as possible through the code alone.

So, on to my problem - I am working on a webpage banner which is primarily static, aside from a brief photo slideshow that is activated when the user clicks a “Start Slideshow” button. Both the button and the slideshow animation are contained within individual movie clips, and the button only has two states (start and stop) delineated by labeled keyframes.

I have managed to write code that drops the button into the banner, in the desired position, and then loads the slideshow clip when the button is clicked. I have even managed to make the button switch to its secondary state visually. What I have not been able to do is change the functionality of that button, so that when the slideshow is running, the button changes to its stop state and will, when clicked, pause the slideshow animation.

In my head it seems like this should be solved by an if/else statement, and I’ve tried to write one that will work using all the deductive logic I can muster, but to no avail - I feel I’m close, but I’m getting a 1136 error with my current code, and aside from the fact that I don’t know how to fix that error, I am concerned that there may be other errors related to poor syntax (I feel I may have made a couple things up along the way!).

So, don’t laugh, but here is my code as it stands now:

EDIT: Fixed indenting problems, hope that helps![INDENT][COLOR=Navy]var btn = new slideshowBtn();
addChild(btn)

btn.x = 640;
btn.y = 5;
btn.gotoAndStop(“start”);

var slides = new MC();
addChild(slides);
slides.x = 475;
slides.y = 23;
slides.alpha = 0;
slides.gotoAndStop(“load”);

function slideControl(e)
{
[/COLOR][INDENT][COLOR=Navy] if (slides.frame == “load”)[/COLOR]
[COLOR=Navy] {[/COLOR][INDENT][COLOR=Navy] btn.addEventListener(MouseEvent.CLICK, startSlides);[/COLOR]
[COLOR=Navy] btn.buttonMode = true;[/COLOR]

[COLOR=Navy] function startSlides(e1)[/COLOR]
[COLOR=Navy] {[/COLOR][INDENT][COLOR=Navy] slides.alpha = 1;[/COLOR]
[COLOR=Navy] slides.gotoAndPlay(“play”);[/COLOR]
[/INDENT][COLOR=Navy] };[/COLOR]
[/INDENT][COLOR=Navy] }[/COLOR]
[COLOR=Navy] else[/COLOR]
[COLOR=Navy] {[/COLOR][INDENT][COLOR=Navy] btn.gotoAndStop(“stop”);[/COLOR]
[COLOR=Navy] btn.addEventListener(MouseEvent.CLICK, stopSlides);[/COLOR]
[COLOR=Navy] btn.buttonMode = true;[/COLOR]

[COLOR=Navy] function stopSlides(e2)[/COLOR]
[COLOR=Navy] {[/COLOR][INDENT][COLOR=Navy] slides.stop();[/COLOR]
[/INDENT][COLOR=Navy] };[/COLOR]
[/INDENT][COLOR=Navy] };[/COLOR]
[/INDENT][COLOR=Navy] };

slideControl();
[/COLOR][/INDENT][COLOR=Black]And just for comparison, here is the code at the last point that it worked (ie with the initial button functionality working):

[/COLOR][INDENT][COLOR=Navy]var btn = new slideshowBtn();
addChild(btn)

btn.x = 640;
btn.y = 5;

btn.gotoAndStop(“start”);
btn.addEventListener(MouseEvent.CLICK, startSlides);
btn.buttonMode = true;

function startSlides(evt)
{
[/COLOR][INDENT][COLOR=Navy] var slides = new MC();[/COLOR]
[COLOR=Navy] addChild(slides);[/COLOR]
[COLOR=Navy] slides.x = 475;[/COLOR]
[COLOR=Navy] slides.y = 23;[/COLOR]

[COLOR=Navy] btn.gotoAndStop(“stop”);[/COLOR]
[/INDENT][COLOR=Navy] };
[/COLOR][/INDENT]Can anyone give me any guidance on how to fix this? Is there a completely different approach I should take? (I realize I may just be completely and utterly boned with this code, but if you can give me any hints as to how to start over, that’d be helpful too.)
TIA!