How to create the break timer function?

Hello. I want to add timer function inside my project which, once user pause timer pause then resume at the time where the user press play. Someone knows how to run since I've tried a few coding it has not worked.

Here is my code.

var endTime:int = getTimer();

endTime += 40 * 60 * 1000;  adjust endTime to 15 minutes in the future.

var countdownTimer:Timer = new Timer (1000);

countdownTimer.addEventListener (TimerEvent.TIMER, updateTime);

countdownTimer.start ();

function updateTime(e:TimerEvent):void

{

var timeLeft:Number = endTime - getTimer();

var seconds: Number = Math.floor(timeLeft / 1000);

var minutes: Number = Math.floor(seconds / 60);

seconds, % = 60;

% of minutes = 60;

var sec: String = seconds.toString ();

var min:String = minutes.toString ();

If (sec.length < 2) {}

s = '0' + seconds;

}

If (min.length < 2) {}

min = "0" + min;

}

var time: String = min + ":" + seconds;

Countdown.Text = time;

}

Using 'getTimer()' on the update of the timer does not allow you to interrupt the timer properly, it takes the time remaining in another way:

var endTime:int = getTimer();

endTime += 40 * 60 * 1000;  adjust endTime to 15 minutes in the future.

var countdownTimer:Timer = new Timer (1000);

countdownTimer.addEventListener (TimerEvent.TIMER, updateTime);

countdownTimer.start ();

function updateTime(e:TimerEvent):void

{

endTime = 1000

    var timeLeft:Number = endTime;

var seconds: Number = Math.floor(timeLeft / 1000);

var minutes: Number = Math.floor(seconds / 60);

seconds, % = 60;

% of minutes = 60;

var sec: String = seconds.toString ();

var min:String = minutes.toString ();

If (sec.length< 2)="">

s = '0' + seconds;

}

If (min.length< 2)="">

min = "0" + min;

}

var time: String = min + ":" + seconds;

Countdown.Text = time;

}

This button is paused the timer using the Boolean variable:

var pause: Boolean = false;

my_btn.addEventListener (MouseEvent.CLICK, onClick);

function onClick(e:MouseEvent):void

{

if(pause == false)

{

countdownTimer.stop ();

break = true;

}

on the other

{

countdownTimer.start ();

break = false;

}

}

Tags: Adobe Animate

Similar Questions

  • How to create a user-defined function?

    is there a substitute for the exe instsrv and srvany in Vista?

    I don't know what means your post, so here's how to create a user-defined function:
    1) click Start
    (2) select "Control Panel".
    (3) select "system and maintenance".
    4) click on "Administrative Tools".
    5) click on "Task Scheduler."
    (6) click on "create task" (right in the list pane under) "Actions") "
    "(7) opened in the general tab it will choose if it only works when the account that is used to implement is connected, or ' if that user is logged in or not" (leave the box ' do not store the... "empty password)
    (8) always in the general tab, check the box 'run with highest privileges '. (This will ensure that no program can block)
    (9) type a name for the task (in the general tab)
    (10) to set the job to run an awhile, use the "triggers" tab, if you want to set a task runs after xx min. temps_inactivite, choose the 'conditions' tab, then choose the desired time.
    (12) click on the 'actions' tab click on 'new '. in the program/script line, search for and select the program you want to run, and then click Open.
    13) click OK in the window "create a task".
    14) click OK again and you are done.
    I hope this helps.

  • Please tell me exactly how to remove the AVG search function

    Please tell me exactly how to remove the AVG search function

    edited by a moderator for clarity

    You need not repeat dozens of times or use profanity to get help.

    (1) disable all non-essential or unrecognized extensions on this tab. Don't know what it does? When in doubt, turn off:

    Firefox orange (or the Tools menu) button > addons > Extensions category

    Use the links above a disabled extension to restart Firefox if some seem to.

    (2) restore your Google search engine:

    https://addons.Mozilla.org/en-us/Firefox/addon/SearchReset/

    (3) check a user.js file (before the release of Firefox, otherwise the parameters in this file can cancel your cleaning) as described in this article: How to fix preferences that will not save.

    (4) If AVG search took over your page to the new tab (Ctrl + t), which changes as follows:

    (A) in a new tab, type or paste Subject: config in the address bar and press ENTER. Click on the button promising to be careful.

    (B) in the filter box, type or paste newtab and make a pause so that the list is filtered

    (C) double-click the preference browser.newtab.url and enter the desired value for your favorite page:

    thumbnails (i) (default) Page = > subject: newtab

    (ii) blank tab = > subject: empty

    Firefox homepage integrated (iii) = > topic: welcome

    (iv) any other page = > full URL of the page

    IMPORTANT: If you have AVG software in your Windows Control Panel, you need to remove it.

  • How to shorten the execution time of the NXT (TETRIX &amp; MATRIX toolkit) brick

    Hello

    How to shorten the execution time of the NXT brick?

    (TETRIX & MATRIX toolkit, running time)

    The software is 2012 LabVIEW for LEGO MINDSTORMS

    Thank you.

    Hi 40123157,

    You use the module in an appropriate manner, and there is no simple way to improve the time of loop iteration beyond what you've done. Here are my suggestions:

    (1) the i2c commands take a long time. In your application, it may speed up if you run only move the engine only when the engine speed has changed.

    (2) for this particular example, you do not use the release of the report engine. If this VI does not need to run it can be removed.

    (3) If you need to speed up execution other than that, as a user advanced LabVIEW, you can create a copy of the VI of engines to move and change it as you choose. All you have to to the "DC motors' entry is use cluster to array on the cluster, as shown below. I think you can speed it up by running all the settings before the loop (type sensor and fixed connection configuration), and removing the value of power if you send only the values between-100 and 100.

    (4) drawing on the screen can be slow you down here.

  • Please show or ask how to create the value of arrayOfValues of setValuesAtTimes parameter?

    Hello AEScriptComm,

    I have a few small scripts that use the method setValueAtTime successfully placing a keyframe on the existing layers of maskPath, but as you can see in the scripts below, results of setValueSatTimeS errors using IE: "Array is not of the correct type", "value is not an array" or "Null is not an object", depending on ,...

    (A) what variable is used as the value of parameter IE:

    .maskPath;

    . maskPath.value;

    . maskPath.value.vertices

    (B) what kind of table is used as the parameter value as in:

    var addTheseKeys = new Array ((1,2,3,4);    (as a parameter of the time)...

    (with either)

    var keyValues = new Array([10,10],[100,100],[15,50],[100,120]);             ...." ]) "

    (GOLD)

    var keyValues = [[10.10], [100 100], [15.50], [100 120]];                               ... (Array of arrays? RE: " ]] " )

    I just read a 'push' of the values in a table may be necessary?, but I was hoping someone who knew setValuesAtTimes could show it please...

    1) .. How to create the value of arrayOfValues of setValuesAtTimes parameter?

    1 (a): WORK setValueAtTime script...

    App.Project.Item (1) .layer (1).property("Masks").property ("mask 1");

    var app.project.item = myProperty (1) .layer (1) .mask (1) .maskPath;

    myShape = app.project.item (1) .layer (1) .mask (1).maskPath.value;

    myProperty.setValueAtTime(1.0,myShape);

    1 (b): If there is no script setValuesAtTimes...

    prop1 = app.project.item var (1) .layer (1).property("ADBE_Transform_Group").property ("ADBE Position");

    var fourKeys = 4;

    var addTheseKeys = new Array (1,2,3,4),

    var keyValues = new Array (10, [10], [100 100], [15.50], [100 120]);

    var app.project.item = myProperty (1) .layer (1) .mask (1) .maskPath;

    myShape = app.project.item (1) .layer (1) .mask (1).maskPath.value;

    var myVertices = app.project.item (1) .layer (1) .mask (1).maskPath.vertices;

    myProperty.setValuesAtTimes (keyValues, addTheseKeys);

    app.beginUndoGroup ("Keys");

    ~ for (var k = 0; k < fourKeys; k ++)

    //~ {

    ~ prop1.setValueAtTime (keyValues [k], addTheseKeys [k]);

    //~ }

    myProperty.setValuesAtTimes (keyValues, addTheseKeys);

    app.endUndoGroup ();

    .. Thanks for any advise\suggestions,

    J

    (A). maskPath.value; It's always a Shape(). (maskPath is a property, not of a shape on its own, and maskPath.value.vertices is only a part of the shape data).

    (B) nothing of what you propose... that is why your failed script fails.

    var keyValues = new Array([10,10],[100,100],[15,50],[100,120]); and

    var keyValues = [[10.10], [100 100], [15.50], [100 120]]; are just as good as arrays of points, the only thing is that keyValues are arrays of objects Shape().

    Read the guide and script for how to report a form of this post (just wrote it...): http://forums.adobe.com/thread/1419866?tstart=0

    Your keyValues array should look like this: [keyValues0, keyValues1, keyValues2, keyValues3], where each entry is a Shape().

    Xavier.

  • How to use the Print Screen function?

    I've seen various descriptions of how to use the print screen function.

    It would be nice to actually tell one that works.  None have worked for me.

    [Fn] and Prt SCr does not work.

    CTRL and Prt SCr does not work.

    CTRL, Alt, and Prt SCr does not work.

    [Fn], Ctrl and Prt SCr does not work.

    If anyone knows the correct method to activate the screen capture function which would be a good thing.

    From the looks of things, HP has a big problem with this function.

    Here's a microsoft articleon the use of the screenshot function.

    This should answer your questions.

    Thanks for taking a peek.

  • Satellite P750 PSAY1A: how to create the recovery Toshiba on the new HARD drive partition

    Hello

    I have an old Toshiba Satellite P750 (PSAY1A-01Y022). I just upgraded my memory from 4 GB to 8 GB and am preparing to take my 500 GB HARD drive 1 TB. I had to order the disk online and wait to happen.

    I always try to understand how to create the arrival of my new HARD drive Toshiba Recovery Partition. I do the same thing for an old book, I handled based on something similar to it's original factory State.

    I have reflected on the recovery partition, but does not know how it was created. It is not NTFS. Does anyone have experience in the creation of a Toshiba Recovery on a new HARD drive Partition?

    And the help is very appreciated.

    Thanks and regards,
    Dinesh

    Recovery partition can be created when you use the original Toshiba Recovery disk and install recovery image. Before the partitions to boot OS install will be automatically created, recovery image copied on a recovery and then partition as last step recovery image installation starts.

    A sort of migration of files from one to the other HARD disk is not solution.

    Only for laptop with factory will work and the usable recovery partition.

  • How to calculate the execution time of a SCTL in FPGA VI?

    Hello

    Can someone guide me that how to calculate the execution time of a SCTL for an iteration in the FPGA VI?

    Thank you and best regards,

    Rashid

    Hello r,.

    A SCTL will always run in a beat the clock it has been linked to.  So, if you use a 40 MHz clock, this loop will run in 25 ns.  If the code cannot complete in that, or if it requires two graduations of the watch to do the calculation, your code does not compile, then you have the guarantee that this will always be how long it takes this piece of code to run.

  • How to calculate the execution time of a loop?

    Hello

    Can someone guide me that how to calculate the execution time of a loop to iterate?

    Thank you and best regards,

    Rashid

    I hope I have your question! See attached screenshot

  • Do you know how to create the façade as a backdrop

    Do you know how to create the façade as the Web, I mean like we did the word and click on it will be rather another process by clicking on the button.

    If possible, I can click on the link in the table... No idea no matter who

    In my view, that the user questioned a hyperlink control. See, for example: http://forums.ni.com/t5/LabVIEW/NI-Example-Finder-Like/m-p/1023011#M455994

    You could probably do this in an XControl.

  • How to create the icon on the desktop just for SilverLight?

    How to create the icon on the desktop just for SilverLight?

    Hello

    • Why is it you are wanting to create a shortcut?
     
    Silverlight is a plugin for Internet Explorer and other browsers, Windows Media Center is to allow video playback which supports silverlight. You cannot create a shortcut for the same.
     
  • How to create the usb flash disk to Reboot

    How to create the reboot usb flash drive. If I want to do a recovery or restart the usb flash drive how to

    Hello

    read the google links

    and make sure that your motherboard allows you to boot from USB

    http://www.Google.com/search?hl=en&source=HP&q=how+to+make+a+USB+flash+drive+bootable&AQ=1&AQI=G3G-c1g3&aql=&OQ=how+to+make+a+USB+flash+drive

    and if you talk about the recovery partition of computer manufacturers from the D: to a bootable flash drive, you can not do

  • I want to know how to create the account admin hiden for my laptop.

    original title: admin account

    I want to know how to create the account admin hiden for my laptop.

    She has windows vista. I'm the only Admin and the only user. No other person has access.

    The hidden account called administrator is already present.  To activate it:

    1. Click on Start > all programs > Accessories .
    2. Right click on command prompt .
    3. Click run as administrator .
    4. In the command prompt window, type net user administrator / Active: Yes
    5. Press enter .

    Boulder computer Maven
    Most Microsoft Valuable Professional

  • How to create the .cod file to run on the Simulator BB9900

    Hi, I already from the zip package in order to use the bbwp command to create the .cod file and be able to run on the simulator of BB9900, but when I run this command as described in: https://developer.blackberry.com/html5/documentation/compile_ww_app_for_smartphones_1873321_11.html

    It creates two files, each with a .bar file, this type of file, I can't run it on the 9900 Simulator but a .cod file is required to run applications on the sim card.

    I don't know how to create the .cod file.

    Thank you

    Have you used Blackberry Webworks SDK for smartphone or Tablet SDK? The .cod files should be located in the subfolder OTAInstall of your output folder if you are using the Webworks SDK for Smartphone

  • How to display the current time?

    Hi all!

    I know how to get the Date / time like this:

    {Label

    text: {}

    New Date();

    }

    }

    in which the label displays, for example: ' 2013-02 - 10 T 15: 52.28.

    How to display ONLY the hour (15)?

    Thank you

    -Ali

    Hello

    Use the formatDateTime Qt method:

    http://Qt-project.org/doc/Qt-4.8/QML-Qt.html#FormatDateTime-method

    For the opening hours:

    varhour = Qt.formatDateTime (new Date(), "hh"); or 'h '.

Maybe you are looking for

  • Update of HP Z620 BIOS causing the disc start plu

    Dear Sir I updated the system of workstations HP Z420/Z620 (International) BIOS to 03.69 Rev.18 June 2014 to my windows 7 Professional. After the reboot, it could not find my boot drive. In the Bios, the order of boot to SATA drive name list is total

  • Record and play back a cluster

    Hello I am a student and I have to perform and LV application.I did the majority of the program, but I have a problem with the backup data.I use a complex cluster (dial other clusters etc.), I can save it as a binary file, but I am not able to open i

  • Windows Server 2003 on the HARD IDE in Mode ATAPI drive?

    Hello! My problem is that I want to know if a HDD IDE will run in Mode ATAPI. More details > There is a motherboard of INTEL S5000 VSA server in the office. He already had Win 2003 and everything was fine until the HARD drive crashed and the people r

  • Error saying Windows is not genuine.

    I have an Acer laptop which is preloaded with Windows Vista Home Premium. Unfortunately, I lost the CD so I downloaded a torrent of Vista version when I reformatted the HD, but it does not accept the CD - Key of the label of Windows on the laptop. Is

  • W 7 Office, want to remove the icons from W - 10 update

    The old office of HP, I had W - 10 and could not get healed now width to W-7 on and it works fine.  Because the machine will work not with W-10 (due to problems of graphics card) I'll leave with W - 7.  Now, how can I get rid of these ads to W - 10 u