Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How do I make the button reset with Flash actionscript?

Guest
Aug 13, 2009 Aug 13, 2009

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. 😃

TOPICS
ActionScript
1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 14, 2009 Aug 14, 2009

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 14, 2009 Aug 14, 2009

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 =]

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 14, 2009 Aug 14, 2009

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 14, 2009 Aug 14, 2009
LATEST

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 😃

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines