How to reset a timer each time the function is called?

Hello

I have my code like below. The main function is called whenever the event occurs. The event occurs when I created a timer which occupies 10 seconds for display purposes.

Once the Main() is called, a message appears and after 10 seconds, the message disappears.

The problem I had met with this code is that the message does not last for 10 seconds when the Main() is called consecutively. For example; when its name for the second time within 10 seconds, the display will show for 6 seconds and maintain the reduction.

Can someone help me with this problem and tell me what to do to reset the timer each time the Main() is called. I also used FeatureState_Timer.reset (), but it did not work.

/ * Declarations of global variables * /.

public var FeatureState_Timer : timer = new Timer (10000);

/ * Global function * /.

function Feature_Timer_Function(timerEvent:TimerEvent): void

{

Message.Visible = false;

Feature_Timer. stop();

}

function Main(event:Event):void

{

FeatureState_Timer .addEventListener (TimerEvent.TIMER, Feature_Timer_Function);

FeatureState_Timer . Start();

Message.Visible = true;

}

Thank you!!

Try to reset the timer first:

function Main(event:Event):void

{

FeatureState_Timer . Reset();

FeatureState_Timer.start ();

Message.Visible = true;

}

If this does not work, use the following code:

function Main(event:Event):void

{

FeatureState_Timer = new Timer (10000);

FeatureState_Timer.addEventListener (TimerEvent.TIMER, Feature_Timer_Function);

FeatureState_Timer.start ();

Message.Visible = true;

}

Tags: Adobe Animate

Similar Questions

  • How to reset my panels to monitor the way they were? I have them in every sense and it is frustrating, especially since I'm new to the premier pro and generally Adobe products...

    How to reset my panels to monitor the way they were? I have them in every sense and it is frustrating, especially since I'm new to the premier pro and generally Adobe products... I also work on a Mac.

    Hi Alexis,.

    Go to window > workspace > handed saved available.

    You will get the same options on a Mac.

    Thank you

    Regalo

  • Help: How do reset you default values for the session and the time-out at the admin level

    Hello

    The DBA was trying to save the settings of time-out value by following the instructions and it kept him setting a default off 28800 timeout of Session Timeout and Idle of 3600.

    He saved the value 1, and now we cannot get to change.

    How do reset you the default preferences?

    Bill,

    Sorry, I missed your point. To undo this damage, try this:

    Connect as SYS

    ALTER session set current_schema = apex_030200
    /
    wwv_flow_platform.set_preference (p_preference_name-online 'MAX_SESSION_IDLE_SEC', p_preference_value-online 3600)
    /
    wwv_flow_platform.set_preference (p_preference_name-online 'MAX_SESSION_LENGTH_SEC', p_preference_value-online 28800)
    /
    Commit
    /

    Adjust 3600 and 28800 as you like.

    Scott

  • C2N25UA #ABA: how to reset my HP laptop to the factory setting, I have a virus

    My computer really works if not answer I have a virus and I read that if I reset to the factory setting that would get rid of the virus, please tell me how to reset to factory setting

    Hello

    There is a good description (including a video preview) of the 3 main methods to do a "factory Reset" on the following link.

    http://support.HP.com/us-en/document/c03489643

    Kind regards

    DP - K

  • How to reset default screen resolution in the laboratory of the VM?

    I have to hit something and now my screen of Web Client VMware vSphere is compensated. I can't search option in the upper right corner of the screen when I do quick research laboratory. There is no horizontal scroll bar at the bottom of the screen for me to scroll and no bar or vertical scrolling.

    This laboratory is running in the browser Firefox, how to reset to the original setting, so I can display a windows all completely with the four corners? Thank you.

    The best option is to adjust the zoom in Firefox.  At the top right, there is an icon with three horizontal lines.  There and then click the icon less (left) to reduce the zoom to about 80%.  This will allow the full vSphere Web Client GUI is displayed even with the small monitors and lower resolution.

  • How to reset my Timer

    Hello!

    I have a question and I hope I can find a solution here. I have a short questionnaire and I want to allow the user only 30 seconds per question to give a good answer.

    I have a 'start' button, which triggers a countdown for the first time. So, I want whenever the user clicks the 'next' button, the countdown to start the new meter from 30 to 0. That's what I've tried so far:

    var fl_SecondsToCountDown:Number = 30;

    var fl_CountDownTimerInstance:Timer = new Timer (1000, fl_SecondsToCountDown);

    fl_CountDownTimerInstance.addEventListener (TimerEvent.TIMER, fl_CountDownTimerHandler);

    start_btn.addEventListener (MouseEvent.Click, startCountdown);

    next_btn.addEventListener (MouseEvent.CLICK, goNext);

    function fl_CountDownTimerHandler(event:TimerEvent):void

    {

    seconds_txt. Text = String (fl_SecondsToCountDown);

    -fl_SecondsToCountDown;

    }

    function startCountdown(e:MouseEvent):void {}

    fl_CountDownTimerInstance.start ();

    }

    function goNext(e:MouseEvent):void {}

    fl_CountDownTimerInstance.reset ();

    }

    Now, what he does is just to stop the countdown to 25 seconds, for example, and then if I ask him to do it again, it starts where he left, rather than return to 30 seconds more.

    Thank you very much!

    use:

    function fl_CountDownTimerHandler(event:TimerEvent):void

    {

    seconds_txt. Text = String(fl_CountDownTimerInstance.repeatCount-fl_CountDownTimerInstance.currentCount);

    }

  • How to preserve date/time the conversion to DNG?

    When to convert a file to DNG in Lightroom, it changes the capture time in the metadata for the date and time, rather than copy the data from the source.  Is there a way in which I can say from my dates alone?

    Normally the DNG conversion transferring metadata from the source file in the DNG format.   It may be that the source file does not have a capture time nested, in which case LR can sometimes become squirrels. The most effective way to solve this:

    --Select a source file that has this problem.

    -Post a screenshot of grid view of library showing what LR thinks, it is the date of capture under the tile.

    -Convert to DNG, but do not delete the original.

    -Download the DNG format and the original to Dropbox (or similar) and post the link here.

    Who must provide all the necessary information to understand what is happening and find a solution.

  • How to reset a regulator to behind the scenes at the stop of the VI

    Hello world

    Hope someone can help me with this (very new to LabView I m) issue:

    I have a loop to control speed (exactly the moment of rotation) of an engine. Just an analog output to a data acquisition device is connected to the motor controller. If I run the VI and to define for example a speed of 50% (= 5 V Analog out) and I close the VI, the DAQ hardware still holds this value for time without end. How can I reset the cursor to '0' when the stop/closure of the VI that my engine stop?

    By the way a "stupid" question: what is the common way to stop a VI? Should be a button 'Cancel' which stops all loops or what to do with the Labview menu "stop"?

    Thank you very much for your answers!

    Markus

    You must control your data flow.

    You could do something like the example attached - is this solved your problem?

    (You must configure your DAQ assistant once again, as I changed it)

    We have a lot of free online training in LabVIEW.

    http://digital.NI.com/src.nsf/Ttitle?OpenView&node=203014_us

    3-hour course:

    http://www.NI.com/white-paper/5243/en

    course of 6 hours:

    http://www.NI.com/white-paper/5241/en

  • How to reset default in sx60hs? The instructions in the manual do not work.

    If you follow the instructions in the manual, the reset button is grayed.  Also the LED screen not working afterwards, but don't not to take pictures.   I am sure that most of the problems is caused to the operator and I think resetting default will help me to start again. Thanks for any help.

    Press the down arrow repeatedly until the LCD lights:

    See if you can do throughout your adjustment menu reset at this time. Otherwise remove your battery and hold the power switch for at least 30 seconds and then insert the battery and try again.

    Also, try the reset all when in Auto mode of shooting first and make sure that you have not selected the WiFi reset all.

  • How to reset a guest account to the factory settings on vista Home premium?

    On running the initial of my computer I have not install my guest properly account. Now, all the icons are the same (see photo) and when I click on any icon to open it, it will always open with windows media player. Any suggestions on how I can restore the settings to factory for the GUEST ACCOUNT ONLY, so I can set it up properly?

    Hi MikeMike10,

    It is not possible to reset the guest account. To work around the problem, you can create another account to guest.

    Create a user account

    http://Windows.Microsoft.com/en-us/Windows-Vista/create-a-user-account

    Hope this information is useful.

  • How to reset all data stored on the mac and modem addresses in win 7

    It seems that my brother when he comes to get the shop computer connected to the internet and it seems that something has happened when you choose what type of network, it is for the connected modem. the thing is that since that point the wizard has not arisen more and I was unable to use the modem to whom it happened.

    When I use my home connection, I use a connection wireless or wired even and all right, but I don't know how can I reset the data stored on the internet devices mac address and dns...

    so if I would again plug into the modem that has happened this problem, he probably pop ups yet what kind of network for the device connected.

    I tried netsh reset, but nothing happened.

    greetings and thanks in advance

    PS: I use win 7 Home Basic. x 64

    Lenovo laptop

    To reset the cache of MAC addresses: netsh interface ip delete arpcache

    To reset the DNS: ipconfig/flushdns

    Edit: remember to do as an administrator. It also can not solve the problem, but it is worth it.
  • How reload/reset 6100/fiber Interconnect in the CLI?

    Hello

    It is there no reload or reboot the command on the 61000 (CLI)? I'll appreciate also answer how do from GUI.  Another similar issue, obviously from a newbie, is to lack "write" command: This means that all accepted orders are automatically written in NVRAM?

    Kind regards

    Taenarum

    Taenarum,

    Certainly, you can restart a FI of the CLI.

    Of the UCSM CLI:

    to connect a local management

    reset

    Also, when change UCSM in the CLI you can noticed that your guest will add an astericks ' * ' at the end.  This means that you have orders waiting to be committed to the system.  If you want to 'save' / 'commit' your changes, you just enter:

    buffer validation

    or

    Stamp throw

    E.g.

    UCS - Has # server scope service profile 2/2

    UCS - Has/org/service-profile # range boot-definition
    UCS - Has/org/service-profile # create boot-definition
    UCS - Has/org/service-profile/boot-definition * # commit buffer

    Kind regards

    Robert

  • How do reset you security settings in the command-line recovery console?

    Windows XP Home Edition.   "Windows XP could not start because the following file is missing or corrupt: \WINDOWS\SYSTEM32\CONFIG\SYSTEM"

    Here are the steps I took:

    Boot from the CD:
    Blue screen "Windows Setup"
    where the bar downstairs tasks would be "loading files" and a bunch of different files are listed.

    Wallpaper then says:
    "The Setup starts Windows.
    then the screen of configuration of Windows XP Professional support

    Welcome to the Setup program:
    -to set up Windows XP press on enter
    -fix Windows XP install using the recovery console and then press 'r '.
    d ' stop smoking...

    I pressed "r".
    "Please wait...". "down
    "Examine the disk configuration...". »
    "Examining 476938 Mo disk to disk

    Black screen "Microsoft Windows XP Recovery Console"
    The Recovery Console provides repair and system restore features. Type EXIT to quit the Recovery Console
    C:\ >

    I do not have access to the operating system and my access to what is always denied. He doesn't want a password to start Recovery console. I ran chkdsk c: /r and showed no errors. I need help resetting my security from a command prompt settings. Everything I've read this is as if the operating system is running.

    Thanks for any help!

    WishIKnewMore

    Someone correct me if I'm wrong, but I've never heard of Windows XP Home Edition 64-bit. The only 64-bit Xp version I've ever seen is Pro. Even not Xp Media Center is available in 64 bits I know.

  • How to make a & quot; savings & quot; the function?

    Hello world
    I am a novice and this is my first time to ask here
    I saw a flash game RPG which have a function 'save', even if it is in offline mode
    Could someone tell me how can he do it please

    Search help the SharedObject class. If they send the Info
    a database server side, while they use a so

    --
    Dave-
    Developer leader
    www.blurredistinction.com
    Adobe Community Expert
    http://www.Adobe.com/communities/experts/

  • How can I customize Firefox to remove the function where the gray browser window in order to highlight a question box?

    Since I upgraded to Firefox 3 (as I waited if long to do because I could not customize the Firefox of the way I wanted) to Firefox 14.0.1, I had a problem.

    I guess one of the sites I visit to try to emulate Windows, where the background turns gray when he wants that focus you on an area of response. So when I'm on a courier website third (Inbox.com) and delete a message when the message box appears to ask me if I really want to delete the message, the background turns gray while the answer box. It never happened on this site when I used Firefox 3, and I would like to avoid this.

    I tried to handle this with an add-on (Element Hiding Helper for Adblock Plus), but it doesn't allow me to select the gray part of the screen, the way in which this is the case not requested "pop-ups".

    Y at - it a Firefox setting or an add-on that I can use to keep the background to become "grayed out"?

    Thank you

    You can set the pref prompts.tab_modal.enabled false on the topic: config to return to the alert style former and prompt pop ups, but it crashes Firefox too long this popup is open. Modal windows are specific tab and do not block the user interface.

Maybe you are looking for

  • App Store works sometimes not not on El Capitan

    Ive noticed that the Mac App Store sometimes does not work on El Capitan in recent weeks. When I try to install an update for an application, it could give a "service unavailable" error or just hang out and not really do anything. If I keep trying, i

  • Photo library

    Pictures location on a MAC now? Since the software completely useless 'photos' was created, it took control of my pictures and I can access is no longer the files into other applications. Why am I not in the control of this machine more? Can someone

  • Please make the great spell checker compatible dicitonery

    Please do Eastern spell checker compatible Windows 7 Firefox Desktop 14.0.1

  • Satellite Pro 2100 - where can I download the drivers

    Hi all My friend has just been given a Toshiba Satellite Pro "sp2100" model number sp210e - 006p 9 - 4 d Although I can find plenty of mentions on Google I can't find this model on this website to download the drivers. I go as far as to select "serie

  • Tecra A11 - 1EG replacement RJ45 Port

    Hi all Can someone point me in the right direction until you get a replacement RJ45 port accommodation as the current broke restraints. Thank you very much Craig