Member Offer
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Flash Action Script 3 help...

Discussion in 'Website Coding & Programming Forum:' started by happi_fairy, Feb 11, 2011.

  1. happi_fairy

    happi_fairy New Member

    Hello!

    I have been set an assignment to make a photo viewer with forward and backwards buttons but my code isn't working :/

    that is the code ive got but the line it seems to have problems with is the one marked with **

    stop ()

    btn1.addEventListener (MouseEvent.CLICK, backward);
    btn2.addEventListener (MouseEvent.CLICK, forward).

    function forward(event:MouseEvent)){ **
    if this.currentFrame == this.totalFrames){
    gotoAndStop(1);
    }
    else{
    nextFrame();
    }
    }
    function backward(event:MouseEvent){
    if this.currentFrame == 1 ){
    gotoAndStop(1): this.totalFrames
    }
    else{
    prevFrame();
    }
    }

    any help would be greatly appreciated as I need this completed by monday!

    Thank you

    :)
    xxxx
     
  2. Corrosive

    Corrosive Moderator Staff Member

    Does it have to be in flash?
     
  3. happi_fairy

    happi_fairy New Member

    yes unfortunately it has to be in flash :/

    I did it a couple of years ago but I really can't find the error at all now! :(
     
  4. Corrosive

    Corrosive Moderator Staff Member

    Oh well, that's out of my comfort-zone I'm afraid.
     
  5. rgregory

    rgregory Member

    This will work:

    stop ()

    btn1.addEventListener (MouseEvent.CLICK, backward);
    btn2.addEventListener (MouseEvent.CLICK, forward);

    function forward(event:MouseEvent)
    {
    if (this.currentFrame == this.totalFrames){
    gotoAndStop(1);
    }
    else{
    nextFrame();
    }
    }

    function backward(event:MouseEvent)
    {
    if (this.currentFrame == 1 ){
    gotoAndStop(this.totalFrames);
    }
    else{
    prevFrame();
    }
    }
     

Share This Page