Isaac, 

You need to enclose each if block with braces {}. 
You can only get away without them when there is only one line of code to
execute following the if. Without the braces your function simply outputs
the trace() (depending which button is pressed) but will run
container.prevFrame(); AND container.nextFrame(); every time no matter which
button is pressed. 

function btnContainerClick(e:MouseEvent):void
{
    if (e.target.name == "btn_prev"){
        trace ("prev. cf: " + container.currentFrame);
//        container.gotoAndStop(container.currentFrame - 1);
          container.prevFrame();
//        container.gotoAndStop(2);
        }

    if (e.target.name == "btn_next"){
        trace ("next. cf: " + container.currentFrame);
//        container.gotoAndStop(container.currentFrame + 1);
          container.nextFrame();
//        container.gotoAndStop(5);
        }
}

- Keith

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Isaac Alves
Sent: Thursday, August 13, 2009 9:16 AM
To: [email protected]
Subject: [Flashcoders] buttons not able to control movieclip's timeline

 i have 2 buttons (prev  and next) that should control the timeline of a
moviclip called "container"

but it just doesn't work. at first it moves to the second frame on this
movieclip then the container shows always the same content ( it has
different content for each frame), the content of the second frame.

though ,  the output panel shows:

prev. cf: 2
next. cf: 1

function btnContainerClick(e:MouseEvent):void
{
    if (e.target.name == "btn_prev")
        trace ("prev. cf: " + container.currentFrame);
//        container.gotoAndStop(container.currentFrame - 1);
          container.prevFrame();
//        container.gotoAndStop(2);

    if (e.target.name == "btn_next")
        trace ("next. cf: " + container.currentFrame);
//        container.gotoAndStop(container.currentFrame + 1);
          container.nextFrame();
//        container.gotoAndStop(5);
}

i get absolutely no clue of what's going on and i'm getting nuts.
i really appreciate any help. thanks a lot.
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to