Sunday, April 4, 2010

How do I make the button reset with...

Hello, I recently made a flash banner that changes frames when you click the next frame and last frame buttons, and it also goes to the next frame on a timer. The thing is, I need the timer to go back to it's starting point when you click one of the buttons, so you don't end up seeing a frame for 2 seconds. Initially, the timer starts at 7 seconds, and when you click a button, I'd like it to go back to 7 seconds. Here's my .FLA file:

http://uppit.com/v/5761GXW6

Also, whenever the banner goes through all of the frames and comes back to the first frame with the buttons, the first frame next_btn stops working for some reason. Thanks if you can solve this.

So yea, if anyone could tell me where to put what actionscript code, or just do it and reupload it for me, I'd appreciate it a lot. Thank you. =)

How do I make the button reset with...

In the code for your button click, just do myTimer.reset(), myTimer.start()

reset stops the timer running, and resets it back to 0. Then you need just start it again.

How do I make the button reset with...

Thanks for the help. I tried adding:

secTimer.reset();
secTimer.start();

Under the gotoandplay functions in every frame on the buttons layer. The thing is, now the frames never stop, they just keep going and going. I understand you said to set the frames back to 7 seconds, but I'm not quite sure how to that, I'm new to flash. What would the code be, and where would I put it? Thanks =]

Post the code you're using for your timer, and I'll see what I can do.

K so here's the code for the timer:

var secTimer:Timer = new Timer(1000, 7);

startTimer();

//secTimer.addEventListener(TimerEvent.TIMER, tik);

secTimer.addEventListener(TimerEvent.TIMER_COMPLETE, skipFrameT);

//next_btn.addEventListener(MouseEvent.CLICK, resetTimer);

//prev_btn.addEventListener(MouseEvent.CLICK, resetTimer);

/*function tik(e:TimerEvent):void

{

trace (''tik'');

}*/

function startTimer ():void

{

secTimer.start();

//trace (''timer Started'');

}

function skipFrameT (e:TimerEvent):void

{

//trace (''time stoped'');

resetTimer();

play();

startTimer();

}

function resetTimer()

{

secTimer.reset();

//trace(''Timer Reseted'');

}

______________________________

That spans across that one layer for every frame. I tried adding the following into every button frame on the buttons layer:

secTimer.reset();
secTimer.start();

Now, what happens is the frames never stop. It just continues to go. I need the timer to go back to 7 seconds. Thanks =)

  • concealer makeup
  • No comments:

    Post a Comment