Need help with my code

Hi Guys ‘n’ Gals,

With the help of another forum member I have managed to create 3 buttons that interoperate. clicking button 1 will close rollouts for buttons 2 and 3 and so forth.

I have been trying to improve the functionality of the code we came up with to include a rewind function on the rollout closes. Previously I was simply playing the movie clips to the end. We were also ‘flipping’ states programatically to open and close the rollouts which was causing issues so I have set these to ‘true’ & ‘false’.

My problem is this, I have the rewind functionality working and enabled, clicking button 1 drops the rollout. Clicking button 2 then closes the rollout for B1 as expected but then my program hangs. I think its getting caught in a loop and I’m not closing off my rewind subroutine properly but have no idea of where to start looking!

Does anything look out of place in this code?

stop();

import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.Event;

// Some vars to hold buttons states and rewind state
var guidanceOpen:Boolean=false;// Default is false but always nice to be able to see what the initial value is
var driverHandoutsOpen:Boolean=false;
var instructorNotesOpen:Boolean=false;
var rewind:Boolean=false;

// Instance rewind function
function gdRewind(e:Event) {
if (rewind==true) {
    guid_docs.prevFrame();
    }
}

function hoRewind(e:Event) {
if (rewind==true) {
    hand_outs.prevFrame();
    }
}

function inRewind(e:Event) {
if (rewind==true) {
    instructor_notes.prevFrame();
    }
}

// Closes all the open drop downs.
function closeAllDropDowns():void {
    if (this.guidanceOpen==true) {
        rewind=true;
        //this.guid_docs.play();
        this.guidanceOpen=false;
    }
    if (this.driverHandoutsOpen==true) {
        rewind=true;
        //this.hand_outs.play();
        this.driverHandoutsOpen=false;
    }
    if (this.instructorNotesOpen==true) {
        rewind=true;
        //this.instructor_notes.play();
        this.instructorNotesOpen=false;
    }
}

// Rollover events
initial.addEventListener(MouseEvent.ROLL_OVER, presOnRollOverHandler);
rereg.addEventListener(MouseEvent.ROLL_OVER, reregOnRollOverHandler);
instructor.addEventListener(MouseEvent.ROLL_OVER, instructorOnRollOverHandler);
handouts.addEventListener(MouseEvent.ROLL_OVER, handoutsOnRollOverHandler);
guidance.addEventListener(MouseEvent.ROLL_OVER, guidanceOnRollOverHandler);

// Release events
guidance.addEventListener(MouseEvent.MOUSE_UP, guidanceOnMouseUpHandler);
instructor.addEventListener(MouseEvent.MOUSE_UP, instructorOnMouseUpHandler);
handouts.addEventListener(MouseEvent.MOUSE_UP, handoutsOnMouseUpHandler);

// onEnterFrame events 
guid_docs.addEventListener (Event.ENTER_FRAME, gdRewind);
hand_outs.addEventListener (Event.ENTER_FRAME, hoRewind);
instructor_notes.addEventListener (Event.ENTER_FRAME, inRewind);

// if you want a hand cursor 
initial.buttonMode=true;
initial.useHandCursor=true;
rereg.buttonMode=true;
rereg.useHandCursor=true;
instructor.buttonMode=true;
instructor.useHandCursor=true;
handouts.buttonMode=true;
handouts.useHandCursor=true;
guidance.buttonMode=true;
guidance.useHandCursor=true;


// rollOver animations
function presOnRollOverHandler(myEvent:MouseEvent) {
    this.initial.gotoAndPlay(2);
}

function reregOnRollOverHandler(myEvent:MouseEvent) {
    this.rereg.gotoAndPlay(2);
}

function instructorOnRollOverHandler(myEvent:MouseEvent) {
    this.instructor.gotoAndPlay(2);
}

function handoutsOnRollOverHandler(myEvent:MouseEvent) {
    this.handouts.gotoAndPlay(2);
}

function guidanceOnRollOverHandler(myEvent:MouseEvent) {
    this.guidance.gotoAndPlay(2);
}

// Open the dropdowns
function guidanceOnMouseUpHandler(myEvent:MouseEvent) {
    this.closeAllDropDowns();// Run the function to close all open drop downs.
    this.guidanceOpen=true;// Set the open property to the opposite of what it was before.
    this.guid_docs.play();
}

function instructorOnMouseUpHandler(myEvent:MouseEvent) {
    this.closeAllDropDowns();
    this.instructorNotesOpen=true;
    this.instructor_notes.play();
}

function handoutsOnMouseUpHandler(myEvent:MouseEvent) {
    this.closeAllDropDowns();
    this.driverHandoutsOpen=true;
    this.hand_outs.play();
}

I hope someone can help, I’m a designer not a coder and the intricacies of AS3 are causing me no end of issues!

Cheers, Funky