Skip to main content
Participating Frequently
January 22, 2013
Answered

[Help]Timeout when going to a new frame!

  • January 22, 2013
  • 1 reply
  • 904 views

Hello Community!!! so i searched for something but i can't found anything!!!

so i have a button... and that button when you are pressing it you ar go to an another frame... but when you will press it again it will go back to the first frame!

so cause i have an error with "FadeSymbolIn" code that when you are going to frame and pressing too early the button to go back... the Flash Player 11 show me an error.... and the Alpha on this frame is going to 2 from 1.

so i want when you are pressing the button and going to a new frame to can't press other button so early... but for example to be freezed for 1 second!!! i want something like that!!!

Please help me if you can! i will be very glad for your help! i am new o flash and don't know too much!!! And sorry for my bad English!!!!!

This topic has been closed for replies.
Correct answer Ned Murphy

man... thank's for your help but the only i exactly want is a timeout timer for the frames....
so when you are pressing a button and going to anther frame, everything will freeze for 1 second...
with that code i will avoid that bug...!!! cause is an effect error... and if you will not press buttons too quickly, you will not have any problem!!!


If you want to time/delay sometrhing happening, then you have a couple choices for timers.  The simplest is to use the setTimeout() function.

     var sto:Number = setTimeout(delayedFunctionName, delayTime);

     function delayedFunctionName(){

         // whatever you execute here will happen after the delayTime passes

     }

The delayTime value is specified in milliseconds.

The other option is to use the Timer class which is a bit more involved since it uses a Timer object and an event listener/handler function.  You should be able to find how to use that if you check out the help documentation or search Google.

1 reply

Ned Murphy
Legend
January 22, 2013

If your code is giving you a problem you need to show the code and the error(s) that you get.

Participating Frequently
January 22, 2013

i don't have any problem on swf...
only on Projector i have this error...
i think is a flash player bug!!! not any wrong code on my script! but take a look!!!

TypeError: Error #1009: Cannot access a property or method of a null object reference.

   at FinalVersion_fla::MainTimeline/fl_FadeSymbolIn_18()[FinalVersion_fla.MainTimeline::frame19:160]

the frame doesn't matter... it will be to all the frames if i will press the buttons too quickly...

and the code that gives the error is:

OSRAM_popup.addEventListener(Event.ENTER_FRAME, fl_FadeSymbolIn_18);

OSRAM_popup.alpha = 0;

function fl_FadeSymbolIn_18(event:Event)

{

          OSRAM_popup.alpha += 0.1;

          if(OSRAM_popup.alpha >= 1)

          {

                    OSRAM_popup.removeEventListener(Event.ENTER_FRAME, fl_FadeSymbolIn_18);

          }

}

is flash player bug cause on swf file i don't have this error when i press the button too quickly

Participating Frequently
January 22, 2013

don't have any solution about my question or my error?!!!