count down the days of text file

Hi all. I use this script

Code:

this.createEmptyMovieClip ("loader_mc", 0);
loadVariables ("assets/flash/splash/deadlines2.txt", loader_mc);
Declaring variables
year;
months;
day;
DESC;
Check if the variable text file are loaded
function varLoaded() {}
If (loader_mc.y! = undefined) {}
year = loader_mc.y;
month = loader_mc.m;
day = loader_mc.d;
DESC = loader_mc.desc;
clearInterval (interval);
}
Then call the function to calculate the difference in days
diffDays();
}
var interval = setInterval (varLoaded, 100);
//
function diffDays() {}
End_date var = new Date (year, month, day);
var tmp_date = new Date();
var now_date = new Date (tmp_date.getFullYear (), tmp_date.getMonth (), tmp_date.getDate ());
var difference = end_date.getTime () - now_date.getTime ();
var daysleft = difference/1000/60/60/24;
desc2. AutoSize = 'left ';
desc2.htmlText =! daysleft? "< b > > today ':" < b > > "+ daysleft + (daysleft > 1?". ("Days < /b > ':"< /b > Day") + desc;
desc2.setTextFormat (new TextFormat ("Verdana", 9));
}

It is quite crumbly, sometimes it works sometimes I get weird results.

If I put this:

y = 2007 & m = 2 & d = 23 & desc = date deadline - March 23, 2007


in the txt file, I 23.9583333333333 days. 23 is not even right. In addition, I do not need these decimals. Any direction would be great.

Thank you
Mike

Thanks much for the advice. I used math.round and it worked very well. I changed:

var daysleft = difference/1000/60/60/24;

TO

var daysleft = Math.round(difference/1000/60/60/24);

Thank you
Mike

Tags: Adobe Animate

Similar Questions

  • error message not in line, counting down the days?

    Hi, one of our creative users Cloud is to get error messages that indicate that it is either not online or there is a problem with our account billing.  The stages of licensing, I went twice with the user.  The Portal team it does not always accept the invitation of the team but currently accepted.  Click to return the rest.   Our other 12 users have no such problems.

    Any ideas?

    I found that despite going to accept the process of 'invitation of the team' several times that he never showed itself in the team portal.   We had been using Internet Explorer.  I finally solved the problem by using Google Chrome to accept the invitation of the team.

  • I thought 5 ESXi free?  VSphere counting down the days of assessment.

    I use vSphere Client to access my esxi Server 5 and VMs.  ESXi 5 free, is free Vsphere Client?  If client vsphere is not free, then how can I access my server and the virtual machines for free?

    1. connection to the host using vSphere Client
    2. Select host
    3. tab Configuration
    4. Click "Features licensed" under the software section
    5. Click on 'Edit' in the corner right uper
    6. Select "assign a new license key to this host.
    7. Click on the "enter" key
    8. ...
    9. Click ok
    10. fact!

    I just did in the hypervisor of test I created in my vmware workstation!

    Post edited by: MagnetBoy

  • Control the Structure of the event with text file

    I'm new relativaly in LabVIEW (experience only about 2 weeks). I am currently control a stepper motor using a structure of the event. Similar to the sample code given by LIFA, I entered my settings how the engine not move away, then press a button on the windows before, and it works this way. I also have other equipment that works as well in LabVIEW, as a transnational step; all components operate individually.

    Now, I'm trying to make the more automated system and to ensure that all the different equipment work in the same code. So, I tried to implement a structure of the event using a text as an input file to try to control events. The text file has a table 1 d of numbers going down vertically (only the line numbers change). So, I used a table of index function to take the numbers one by one, use a loop (while loop in this example) to go to the bottom of the column of numbers. However, the event not register the change, even if the indicator shows the value is changing.

    Attached, it's my test code and the text file that I use to try to control the structure of the event. Please let me know what I am doing wrong. Thank you.

    Oh, now I understand what you tried to say. I'm using a loop and a case structure to activate different events with the entries in the table. I thought case structures and event were the same, but you taught me the event structures are used just for the façade stuff. Thank you all!

  • How to save the contents of the RichTextBox to text file

    Hello

    Do I NEED to SAVE THE content of RichTextBox in text file?

    If it IS a question of LabVIEW, here is an example of how load a rich text file (to help you if you don't know how to get a rich text in LabVIEW).

    If you have a rich text box, you can use the "SaveFile" invoke method to match the function that you have linked to.

  • Problem with the creation of text file 9530 unit

    Hello

    I created the text file in the memory of the device "file:///store/home/user/sample/mytext.txt" with a text using my application. He created the file with the extension "mytext.txt.rem". While I couldn't able to read the same file.

    I tested the same application with 8520 and its works very well... It creates the file "mytext.txt" only.

    I don't know why the name of the text file adds extension ".rem" in 9530.

    Could you please help me to findout the solution?

    Thank you

    SmartPhoneDev

    You have enabled encryption.  Have a look here:

    http://supportforums.BlackBerry.com/T5/Java-development/why-my-text-written-to-a-file-on-the-SD-card...

  • Individual unique watermark printing a document for many users in accordance with the list in text file

    Mr President.

    I have a unique requirement. I have proposed something and I put a single PDF file in this folder. I also have a text file with the name and number of the user. I want to make a script that will read the name in the list and print a copy of the PDF document with the name and the number one watermark diagonally on each page. Then the second name is included in the list and printed. All the names on the list should be printed with the unique name & number a watermark on each page.

    Can help me please, in the script.

    First of all, you have posted in the forum of reader. You have the drive or the complete Acrobat? You can not do with precedent, only the last (and then even in special circumstances).

    What you're asking for is possible to achieve (in Acrobat), but it requires a script to measure. You cannot expect the people here to write this script for you. We will be happy to help you with any specific questions you may have, but if you want someone to create the whole thing for you, you will probably need to hire to do it. I have developed several similar tools in the past (for example: Scripts Adobe custom: Acrobat - file PDF Batch Watermark A ), so I'm happy to create this script for you, for a fee.

    You can contact me to discuss it further, if you wish.

  • Is there a maximum size or the limit of text file during storage and data transfer?

    HI -.

    We used WriteExtFile and AppendExtFile to store data in a CSV text file in a data folder in the same location as the executable files of Authorware.

    WriteExtFile ("data\\"^"Variable_Names.txt", Survey_Variable_Names)

    AppendExtFile ("data\\Survey_DATA.txt", Survey_Data)

    As a general rule, we always put our executable files on the hard disk of the computer (c) due to some issues we had with an incompatible network drive in the past.  Have the files on the C: drive, eliminated any network problem.  Our data has accumulated would be always stored on the C: drive as well.

    Now, we need to store a backup copy of the data on a server, on the C: drive.

    My question is: is there is a maximum file size that can be "read in" and then "written" using Authorware?

    My thought was to use ReadExtFile to read the content of the 'Survey_DATA.txt' file and use WriteExtFile to write these same data on a drive on the network, by adding the date and time at the end of the name of the file as a backup file.

    I used this logic, which is working to write on the "P": network drive

    WriteExtFile ("P:\\Survey_Project\\BackupData\\DATA_BACKUP_"^Backup_Date^"_"^Backup_Time^".txt", Survey_Backup_Data)

    Of course, the size of the original text on the C: drive file will continue to grow because "AppendExtFile" is used to add the data of every investigation file in the data file (CSV, each record on its own line).  If the size of the file we will read again (ReadExtFile) will also continue to grow.

    Is there a limit to what we can read in and then write back?

    Thank you!

    Scott

    My apologies, it has been a few years...

    CopyFile is a function that you can load the WinAPI.u32

    Once loaded, use it like this

    Success: = CopyFile (FileLocation ^ "Sourcefile.txt",)

    Destination ^ "DestinationFilename.txt") "

    Remember that you must include WinAPI.u32 with your packed files.

    Steve

  • responding to the message in text file

    I'm trying to write a script which will automatically be selected in Mail, a message with the content of a specific file and also BCC answer me.  Here's what I'm trying:

    say application "Mail".

    define the selection of selection

    defined theSelectedMessage to the point 1 of selection

    the value theReplyMessage to answer theSelectedMessage with window and meet all

    define theText in the read file "Macintosh models HD:Users:foobar:Documents:Email: the Reply.txt.

    the value content of theReplyMessage in theText

    say theReplyMessage

    make new BCC recipient with properties {name: "Foobar" ', address: '[email protected]' "}

    end say

    end say


    I get an error in the set contained line, saying "Mail has been an error: failed to set all element content.»

    What I am doing wrong?  Thanks in advance...

    Hello

    I don't really know why your code does not work. However, to work around the problem, you can replace this single line:

    the value content of theReplyMessage in theText

    with these five lines:

    activate

    line break & letexte of the Clipboard in the value

    Repeat until (Clipboard) = (letexte & line break)

    end Repeat

    say application 'System events' to hit 'v' {control down}

  • Research Assistant is not in the .java (a text file) files.

    With the help of "Research Assistant", I am unable to search and find words in documents with the extension: 'java' even when I choose 'all files and folders ".

    What should I do to make a search in the .java files?

    I noticed that the 'File Type' dropdown does not include the extension .java or Java file listed. In my 'Folder Options/File Types', I 'JAVA' in Extensions, and 'Java file' in column 'of file types. I also have WordPad listed as default application for 'open with '.

    Thanks for any help.

    Hi Phil Freihofner,

    Follow the steps in the article.

    By using the search criteria "a word or phrase in the file" may not work

    http://support.Microsoft.com/kb/309173

    Note: This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following link. http://support.Microsoft.com/kb/322756

    For reference: How to search for files and folders in Windows XP

  • PSE12 slow down the loading of Fujifilm files in slide show

    I just upgraded from PSE10 to PSE12 and now when I use the slideshow (fullscreen) in the menu Organizer with Fujifilm Raw files take about a minute and a half to load upwards and even again when you zoom in. Is it possible to speed this up in PSE12? He soon PSE10, but it took more than a minute in total.

    Blue36 wrote:

    I do not I have no file conversion. dng or png.

    Ok.

    Are you worried if discuss us the merits related to transporting to different types of conversion?

    I see no other possibility now that staying with PSE10 or upgrade to Lightroom, which implies a very robust material.

  • I can't access some websites using Firefox. For my own site, I get "file not found". My Yahoo downloads in the form of text. No problems with browsers IE or Chrome

    I can't access some websites using Firefox. Pages say "File not found" or in the case of Yahoo and Facebook, they resemble the on-screen text files. No problems with my computer and it is not the case with my browsers IE and Chrome. Already deleted and reinstalled Firefox and it has not solved the problem

    You can also do a check of malware with some digitization programs of malicious software on the Windows computer.

    Please scan with all programs, because each program detects a different malicious program.

    All of these programs have free versions.

    Make sure that you update each program to get the latest version of their databases before scanning.

    Alternatively, you can write a check for an infection rootkit TDSSKiller.

    See also:

  • is it possible to slow down the speed of scrolling text in the distance away from text generator?

    I'm trying to slow down the speed of text scrolling in the distance away from text generator.  Is it possible to make the text scrolls more slow?

    Stretch it to extend it.

  • How to save data in the text file of Spartan 3

    Hi all

    I would like to kindly save the data table text file or a spreadsheet on vi using fpga spartan 3e as an fpga target. Once I added all the functions related to the operation of file, it gave an error that these functions are not supported by the target device.

    could you please help me with this

    Thank you

    Rania

    Hi David,

    Thank you for posting. You use LabVIEW? If so, what version of LabVIEW FPGA do you use? You use a host VI, or any deployment of code at your target to run? The file IO VI probably won't compile to target because they are not intended to be used on your host computer. Resources and the paths of files do not exist on the target FPGA, but rather on the side of the host. I have included a link below that describes how to transfer data between the FPGA and host. I hope this helps!

    http://zone.NI.com/reference/en-XX/help/371599F-01/lvfpgaconcepts/pfi_data_transfer/

  • Write in the text file on request

    Hello

    I've been struggling with the "write to text file" in the part of the attached .vi button

    I want to be able to say my program when I press on the Boolean key it should collect 1 sample point only from the mean.vi - now that I managed to do a Boolean-button that starts the collection of data and then I have to press the button again when I 'think' now, I collected a data point using the structure of the case.

    Can someone help me to collect the data a not that when I press the Boolean?

    Thank you!

    Change the mechanical action of the key "lock when released.  It is an option to right click on the button on the front panel.

Maybe you are looking for

  • ICloud for Apple music activation will damage my iTunes library?

    I agree with Apple's music and I understand that if I want to add pieces of Apple's music in my iTunes library I must activate iCloud. I have so far resisted doing this since all reports of permanent damage to your library master iTunes at the time w

  • Management errors in the grid lines

    I am designing a good system for a project of management errors, I'm working on, but I encountered a problem of 'design '. I thought it would be good to ask some advice here before I sit down and start creating the system of error handling. I have mo

  • MISSED SCHEDULED TASKS FROM SIMULTANEOUSLY

    I run Windows 7, 64 Bit, Home Basic edition. I have run several tasks planned several based on VB Scripts and Batch files. All my scheduled tasks are sometimes triggered when I'm most likely available on my laptop. To trigger my scheduled tasks, a ba

  • BlackBerry Smartphones BB does not synchronize with the Desktop Manager

    Suddenly, my BB 8220 does not synchronize with my Desktop Manager. He tries to synchronize the calendar and then I get an error message: BlackBerry desktop has encountered a problem and needs to close. It should also synchronize my contacts and tasks

  • Foursquare blackBerry smartphones

    NO application Foursquare under Advanced Options > Applications