[Flashcoders] buttons not able to control movieclip's timeline

2009-08-13 Thread Isaac Alves
 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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] buttons not able to control movieclip's timeline

2009-08-13 Thread Jer Brand
Should
  if (e.target.name == btn_next)

be

  if (e.currentTarget.name http://e.target.name/ == btn_next)


It's just a guess as I can't see the fla.


Jer


On Thu, Aug 13, 2009 at 9:15 AM, Isaac Alves isaacal...@gmail.com wrote:

   if (e.target.name == btn_next)

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] buttons not able to control movieclip's timeline

2009-08-13 Thread Keith Reinfeld
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: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Isaac Alves
Sent: Thursday, August 13, 2009 9:16 AM
To: flashcoders@chattyfig.figleaf.com
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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders