Search Results

Search found 3661 results on 147 pages for 'timer jobs'.

Page 6/147 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Javax Swing Timer Help

    - by kap
    Hello Guys, I am having some problems concerning starting javax.swing.Timer after a mouse click. I want to start the timer to perform some animation after the user clicks on a button but it is not working. Here are the code snippets: public class ShowMe extends JPanel{ private javax.swing.Timer timer; public ShowMe(){ timer = new javax.swing.Timer(20, new MoveListener()); } // getters and setters here private class MoveListener implements ActionListener { public void actionPerformed(ActionEvent e) { // some code here to perform the animation } } } This is the class which contains a button so that when the user clicks on the button the timer starts to begin the animation public class Test{ // button declarations go here and registering listeners also here public void actionPerformed(ActionEvent e) { if(e.getSource() == this.btnConnect){ ShowMe vis = new ShowMe(); vis.getTimer().start(); } } } I want to start the timer to begin the animation but it is not working. Need help how to make a timer start after button click. Thanks.

    Read the article

  • boost timer usage question

    - by stefita
    I have a really simple question, yet I can't find an answer for it. I guess I am missing something in the usage of the boost timer.hpp. Here is my code, that unfortunately gives me an error message: include <boost/timer.hpp> int main() { boost::timer t; } And the error messages are as follows: /usr/include/boost/timer.hpp: In member function ‘double boost::timer::elapsed_max() const’: /usr/include/boost/timer.hpp:59: error: ‘numeric_limits’ is not a member of ‘std’ /usr/include/boost/timer.hpp:59: error: ‘::max’ has not been declared /usr/include/boost/timer.hpp:59: error: expected primary-expression before ‘double’ /usr/include/boost/timer.hpp:59: error: expected `)' before ‘double’ The used library is boost 1.36 (SUSE 11.1). Thanks in advance!

    Read the article

  • WPF: Timers

    - by Ilya Verbitskiy
    I believe, once your WPF application will need to execute something periodically, and today I would like to discuss how to do that. There are two possible solutions. You can use classical System.Threading.Timer class or System.Windows.Threading.DispatcherTimer class, which is the part of WPF. I have created an application to show you how to use the API.     Let’s take a look how you can implement timer using System.Threading.Timer class. First of all, it has to be initialized.   1: private Timer timer; 2:   3: public MainWindow() 4: { 5: // Form initialization code 6: 7: timer = new Timer(OnTimer, null, Timeout.InfiniteTimeSpan, Timeout.InfiniteTimeSpan); 8: }   Timer’s constructor accepts four parameters. The first one is the callback method which is executed when timer ticks. I will show it to you soon. The second parameter is a state which is passed to the callback. It is null because there is nothing to pass this time. The third parameter is the amount of time to delay before the callback parameter invokes its methods. I use System.Threading.Timeout helper class to represent infinite timeout which simply means the timer is not going to start at the moment. And the final fourth parameter represents the time interval between invocations of the methods referenced by callback. Infinite timeout timespan means the callback method will be executed just once. Well, the timer has been created. Let’s take a look how you can start the timer.   1: private void StartTimer(object sender, RoutedEventArgs e) 2: { 3: timer.Change(TimeSpan.Zero, new TimeSpan(0, 0, 1)); 4:   5: // Disable the start buttons and enable the reset button. 6: }   The timer is started by calling its Change method. It accepts two arguments: the amount of time to delay before the invoking the callback method and the time interval between invocations of the callback. TimeSpan.Zero means we start the timer immediately and TimeSpan(0, 0, 1) tells the timer to tick every second. There is one method hasn’t been shown yet. This is the callback method OnTimer which does a simple task: it shows current time in the center of the screen. Unfortunately you cannot simple write something like this:   1: clock.Content = DateTime.Now.ToString("hh:mm:ss");   The reason is Timer runs callback method on a separate thread, and it is not possible to access GUI controls from a non-GUI thread. You can avoid the problem using System.Windows.Threading.Dispatcher class.   1: private void OnTimer(object state) 2: { 3: Dispatcher.Invoke(() => ShowTime()); 4: } 5:   6: private void ShowTime() 7: { 8: clock.Content = DateTime.Now.ToString("hh:mm:ss"); 9: }   You can build similar application using System.Windows.Threading.DispatcherTimer class. The class represents a timer which is integrated into the Dispatcher queue. It means that your callback method is executed on GUI thread and you can write a code which updates your GUI components directly.   1: private DispatcherTimer dispatcherTimer; 2:   3: public MainWindow() 4: { 5: // Form initialization code 6:   7: dispatcherTimer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 1) }; 8: dispatcherTimer.Tick += OnDispatcherTimer; 9: } Dispatcher timer has nicer and cleaner API. All you need is to specify tick interval and Tick event handler. The you just call Start method to start the timer.   private void StartDispatcher(object sender, RoutedEventArgs e) { dispatcherTimer.Start(); // Disable the start buttons and enable the reset button. } And, since the Tick event handler is executed on GUI thread, the code which sets the actual time is straightforward.   1: private void OnDispatcherTimer(object sender, EventArgs e) 2: { 3: ShowTime(); 4: } We’re almost done. Let’s take a look how to stop the timers. It is easy with the Dispatcher Timer.   1: dispatcherTimer.Stop(); And slightly more complicated with the Timer. You should use Change method again.   1: timer.Change(Timeout.InfiniteTimeSpan, Timeout.InfiniteTimeSpan); What is the best way to add timer into an application? The Dispatcher Timer has simple interface, but its advantages are disadvantages at the same time. You should not use it if your Tick event handler executes time-consuming operations. It freezes your window which it is executing the event handler method. You should think about using System.Threading.Timer in this case. The code is available on GitHub.

    Read the article

  • Inaccurate performance counter timer values in Windows Performance Monitor

    - by krisg
    I am implementing instrumentation within an application and have encountered an issue where the value that is displayed in Windows Performance Monitor from a PerformanceCounter is incongruent with the value that is recorded. I am using a Stopwatch to record the duration of a method execution, then first i record the total milliseconds as a double, and secondly i pass the Stopwatch's TimeSpan.Ticks to the PerformanceCounter to be recorded in the Performance Monitor. Creating the Performance Counters in perfmon: var datas = new CounterCreationDataCollection(); datas.Add(new CounterCreationData { CounterName = name, CounterType = PerformanceCounterType.AverageTimer32 }); datas.Add(new CounterCreationData { CounterName = namebase, CounterType = PerformanceCounterType.AverageBase }); PerformanceCounterCategory.Create("Category", "performance data", PerformanceCounterCategoryType.SingleInstance, datas); Then to record i retrieve a pre-initialized counter from a collection and increment: _counters[counter].IncrementBy(timing); _counters[counterbase].Increment(); ...where "timing" is the Stopwatch's TimeSpan.Ticks value. When this runs, the collection of double's, which are the milliseconds values for the Stopwatch's TimeSpan show one set of values, but what appears in PerfMon are a different set of values. For example... two values recorded in the List of milliseconds are: 23322.675, 14230.614 And what appears in PerfMon graph are: 15.546, 9.930 Can someone explain this please?

    Read the article

  • asp.net/jquery - Countdown timer not working

    - by Julian
    Here is the full code: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script> <style type="text/css"> @import "jquery.countdown.css"; </style> <script type="text/javascript" src="Scripts/jquery.countdown.js"></script> <script type="text/javascript"> $('#shortly').countdown({ until: shortly, onExpiry: liftOff, layout: "{ps} seconds to go" }); $(document).ready(function () { shortly = new Date(); shortly.setSeconds(shortly.getSeconds() + 5.5); $('#shortly').countdown('change', { until: shortly }); }); function liftOff() { // refresh the page windowwindow.location = window.location; } </script> </head> <body> <form id="form1" runat="server"> <span id="shortly"></span> </form> </body> </html> I've got the jquery.countdown.js in the Scriptsmap of visual studio. Also the stylesheet "jquery.countdown.css" is in the project. Don't have a clue about what the problem could be. I'm kind of new to jquery and trying to learn it.

    Read the article

  • Object Oriented database development jobs

    - by GigaPr
    Hi, i am a software engineering student currently looking for a job as developer. I have been offered a position in a company which implements software using object oriented databases. these are something completely new for me as at university we never worked on it, just some theory. my questions are do you think is a good way to start my career as developer? what is the job market for this type of developemnt? are these skills requested? what markets this technology touches? thanks

    Read the article

  • Are government programming jobs good?

    - by Absolute0
    I am a passionate software developer and greatly enjoy programming. However I was recently contacted regarding a developer lead position for a government job at NYC for the fire department. The pay is pretty good, and I would assume the position has good job security and stability. But I am hesitant to even go for an interview as it seems like an exaggerated version of Office Space with a lot of Bureaucracy and mindless paper work. The description is as follows: The Lead Applications Developer, supporting the Programming Group, will be responsible for all phases of the system development life cycle including performing system analysis, requirements definition, database design, preparation of scopes of work, and development of project plans. Supervise programming staff and manage projects involving the design, implementation, maintenance, and enhancement of complex Oracle based user applications using Oracle Development tools. Applications will be deployed using Oracle Application Server utilizing programming languages such as JAVA, JSF, JSP, Oracle ADF, PL/SQL, and XML with J2EE and EJB technology. Anyone with previous government experience can share their two cents on this? Thank you.

    Read the article

  • jQuery timer, ajax, and "nice time"

    - by Mil
    So for this is what I've got: $(document).ready(function () { $("#div p").load("/update/temp.php"); function addOne() { var number = parseInt($("#div p").html()); return number + 1; } setInterval(function () { $("#div p").text(addOne()); }, 1000); setInterval(function () { $("#geupdate p").load("/update/temp.php");} ,10000); }); So this grabs a a UNIX timestamp from temp.php and puts into into #div p, and then adds 1 to it every second, and then every 10 seconds it will check the original file to keep it up to speed. My problem is that I need to format this UNIX timestamp into a format such as "1 day 3 hours 56 minutes and 3 seconds ago", while also doing all the incrementation and ajax calls. I'm not very experienced with jquery/javascript, so I might be missing something basic.

    Read the article

  • System.Timers.Timer leaking due to "direct delegate roots"

    - by alimbada
    Apologies for the rather verbose and long-winded post, but this problem's been perplexing me for a few weeks now so I'm posting as much information as I can in order to get this resolved quickly. We have a WPF UserControl which is being loaded by a 3rd party app. The 3rd party app is a presentation application which loads and unloads controls on a schedule defined by an XML file which is downloaded from a server. Our control, when it is loaded into the application makes a web request to a web service and uses the data from the response to display some information. We're using an MVVM architecture for the control. The entry point of the control is a method that is implementing an interface exposed by the main app and this is where the control's configuration is set up. This is also where I set the DataContext of our control to our MainViewModel. The MainViewModel has two other view models as properties and the main UserControl has two child controls. Depending on the data received from the web service, the main UserControl decides which child control to display, e.g. if there is a HTTP error or the data received is not valid, then display child control A, otherwise display child control B. As you'd expect, these two child controls bind two separate view models each of which is a property of MainViewModel. Now child control B (which is displayed when the data is valid) has a RefreshService property/field. RefreshService is an object that is responsible for updating the model in a number of ways and contains 4 System.Timers.Timers; a _modelRefreshTimer a _viewRefreshTimer a _pageSwitchTimer a _retryFeedRetrievalOnErrorTimer (this is only enabled when something goes wrong with retrieving data). I should mention at this point that there are two types of data; the first changes every minute, the second changes every few hours. The controls' configuration decides which type we are using/displaying. If data is of the first type then we update the model quite frequently (every 30 seconds) using the _modelRefreshTimer's events. If the data is of the second type then we update the model after a longer interval. However, the view still needs to be refreshed every 30 seconds as stale data needs to be removed from the view (hence the _viewRefreshTimer). The control also paginates the data so we can see more than we can fit on the display area. This works by breaking the data up into Lists and switching the CurrentPage (which is a List) property of the view model to the right List. This is done by handling the _pageSwitchTimer's Elapsed event. Now the problem My problem is that the control, when removed from the visual tree doesn't dispose of it's timers. This was first noticed when we started getting an unusually high number of requests on the web server end very soon after deploying this control and found that requests were being made at least once a second! We found that the timers were living on and not stopping hours after the control had been removed from view and that the more timers there were the more requests piled up at the web server. My first solution was to implement IDisposable for the RefreshService and do some clean up when the control's UnLoaded event was fired. Within the RefreshServices Dispose method I've set Enabled to false for all the timers, then used the Stop() method on all of them. I've then called Dispose() too and set them to null. None of this worked. After some reading around I found that event handlers may hold references to Timers and prevent them from being disposed and collected. After some more reading and researching I found that the best way around this was to use the Weak Event Pattern. Using this blog and this blog I've managed to work around the shortcomings in the Weak Event pattern. However, none of this solves the problem. Timers are still not being disabled or stopped (let alone disposed) and web requests are continuing to build up. Mem Profiler tells me that "This type has N instances that are directly rooted by a delegate. This can indicate the delegate has not been properly removed" (where N is the number of instances). As far as I can tell though, all listeners of the Elapsed event for the timers are being removed during the cleanup so I can't understand why the timers continue to run. Thanks for reading. Eagerly awaiting your suggestions/comments/solutions (if you got this far :-p)

    Read the article

  • Qt - QTimeEdit as a timer viewer

    - by Narek
    I have a QTimeEdit which I want to set to some value and the each second I want to decrease by 1 the value that shows the QTimeEdit. So when it will be 0, the I want to have a QMeesageBox that says "Your time is off.". Can I some how do this with QTimeEdit interface, or I should use QTimer?

    Read the article

  • High precision event timer

    - by rahul jv
    #include "target.h" #include "xcp.h" #include "LocatedVars.h" #include "osek.h" /** * This task is activated every 10ms. */ long OSTICKDURATION; TASK( Task10ms ) { void XCP_FN_TYPE Xcp_CmdProcessor( void ); uint32 startTime = GetQueryPerformanceCounter(); /* Trigger DAQ for the 10ms XCP raster. */ if( XCPEVENT_DAQ_OVERLOAD & Xcp_DoDaqForEvent_10msRstr() ) { ++numDaqOverload10ms; } /* Update those variables which are modified every 10ms. */ counter16 += slope16; /* Trigger STIM for the 10ms XCP raster. */ if( enableBypass10ms ) { if( XCPEVENT_MISSING_DTO & Xcp_DoStimForEvent_10msRstr() ) { ++numMissingDto10ms; } } duration10ms = (uint32)( ( GetQueryPerformanceCounter() - startTime ) / STOPWATCH_TICKS_PER_US ); } What would be the easiest (and/or best) way to synchronise to some accurate clock to call a function at a specific time interval, with little jitter during normal circumstances, from C++? I am working on WINDOWS operating system now. The above code is for RTAS OSEK but I want to call a function at a specific time interval for windows operating system. Could anyone assist me in c++ language ??

    Read the article

  • What is a simple way to add a timer to a method

    - by John
    The following is in C#. I'm trying to do something very simple (I think). I have a method that loads an XML document XDocument doc = XDocument.Load(uri); , but I don't want to tie up pc resources if there are issues (connectivity, document size, etc.). So I'd like to be able to add a timeout variable that will cut the method off after a given number of seconds. I'm a newbie when it comes to asynchronous programming and find it confusing that there are so many examples written so many different ways . . . and none of them appear simple. I'd like a simple solution, if possible. Here's my thoughts so far on possible solution paths: 1) A method that wraps the existing load public XDocument LoadXDocument(string uri, int timeout){ //code } 2) A wrapper, but as an extension method XDocument doc = XDocument.LoadWithTimeout(string uri, int timeout); 3) A generic extension method. Object obj = SomeStaticClass.LoadWithTimeout(??? method, int timeout); 3), on its face seems really nice, because it would mean being able to generically add timeouts to many different method calls and not specifically tied to one type of object, but I suspect that it is either i)impossible or ii) very difficult. Please assist. Thanks.

    Read the article

  • How to use timer in a thread

    - by Anjaneyulu
    Hi, I would like to send email notifications to users of my project exactly at 8 a.m, Here we are using a thread to send emails to the user. I would like to send some emails exactly at 8 A.M. How can I execute that perticular logic in this Thread. Please help me.

    Read the article

  • Dealbreakers for new programming jobs?

    - by Echostorm
    What might be said or implied at an interview or job posting that should set off alarm bells for a coder? I'm still only a few years in the industry but I already know to look out for excessive red tape and bureaucracy. Cubes and a noisy office also tell me that I'll be both miserable and unproductive and that management does not appreciate what coders need to work well. Edit: The way things are going I'm taking extra time to look at the company's stability. If they depend on a single vendor for their livelihood and could be out of business if the vendor decides they don't really need the service or can do it in-house. What are your dealbreakers?

    Read the article

  • Boot splash broken by "SP5100 TCO timer: mmio address 0xyyyyyyy already in use"

    - by mogliii
    I have ubuntu 11.04 with all the latest updates. I have an ATI HD 4350 graphics card and the "ATI/AMD proprietary FGLRX graphics driver" activated. The reported behaviour does not affect the functionality, its just an optical thing. When I booted up using the desktop CD, the ubuntu boot splash was shown correctly in high resolution. Now after installation with FGLRX the dipsplay is broken (see picture). http://img824.imageshack.us/img824/7269/tcotimer.jpg This is what can be found in dmesg [ 8.621803] SP5100 TCO timer: SP5100 TCO WatchDog Timer Driver v0.01 [ 8.621967] SP5100 TCO timer: mmio address 0xfec000f0 already in use [ 8.622650] fglrx: module license 'Proprietary. (C) 2002 - ATI Technologies, Starnberg, GERMANY' taints kernel. [ 8.622656] Disabling lock debugging due to kernel taint This is what MMIO means: https://en.wikipedia.org/wiki/Memory-mapped_I/O Any idea how to get back the high-res splash?

    Read the article

  • Questions re: Eclipse Jobs API

    - by BenCole
    Similar to http://stackoverflow.com/questions/8738160/eclipse-jobs-api-for-a-stand-alone-swing-project This question mentions the Jobs API from the Eclipse IDE: ...The disadvantage of the pre-3.0 approach was that the user had to wait until an operation completed before the UI became responsive again. The UI still provided the user the ability to cancel the currently running operation but no other work could be done until the operation completed. Some operations were performed in the background (resource decoration and JDT file indexing are two such examples) but these operations were restricted in the sense that they could not modify the workspace. If a background operation did try to modify the workspace, the UI thread would be blocked if the user explicitly performed an operation that modified the workspace and, even worse, the user would not be able to cancel the operation. A further complication with concurrency was that the interaction between the independent locking mechanisms of different plug-ins often resulted in deadlock situations. Because of the independent nature of the locks, there was no way for Eclipse to recover from the deadlock, which forced users to kill the application... ...The functionality provided by the workspace locking mechanism can be broken down into the following three aspects: Resource locking to ensure multiple operations did not concurrently modify the same resource Resource change batching to ensure UI stability during an operation Identification of an appropriate time to perform incremental building With the introduction of the Jobs API, these areas have been divided into separate mechanisms and a few additional facilities have been added. The following list summarizes the facilities added. Job class: support for performing operations or other work in the background. ISchedulingRule interface: support for determining which jobs can run concurrently. WorkspaceJob and two IWorkspace#run() methods: support for batching of delta change notifications. Background auto-build: running of incremental build at a time when no other running operations are affecting resources. ILock interface: support for deadlock detection and recovery. Job properties for configuring user feedback for jobs run in the background. The rest of this article provides examples of how to use the above-mentioned facilities... In regards to above API, is this an implementation of a particular design pattern? Which one?

    Read the article

  • Game programming and quantity of timers

    - by andresjb
    I've made a simple 2D game engine using C# and DirectX and it's fully functional for the demo I made to test it. I have a Timer object that uses QueryPerformanceCounter and I don't know what's the better choice: use only one timer in the game loop to update everything in the game, or an independent timer in every object that needs one. My worry is that when I try to implement threads, what will happen with timers? What happens with the sync?

    Read the article

  • Re-running SSRS subscription jobs that have failed

    - by Rob Farley
    Sometimes, an SSRS subscription for some reason. It can be annoying, particularly as the appropriate response can be hard to see immediately. There may be a long list of jobs that failed one morning if a Mail Server is down, and trying to work out a way of running each one again can be painful. It’s almost an argument for using shared schedules a lot, but the problem with this is that there are bound to be other things on that shared schedule that you wouldn’t want to be re-run. Luckily, there’s a table in the ReportServer database called dbo.Subscriptions, which is where LastStatus of the Subscription is stored. Having found the subscriptions that you’re interested in, finding the SQL Agent Jobs that correspond to them can be frustrating. Luckily, the jobstep command contains the subscriptionid, so it’s possible to look them up based on that. And of course, once the jobs have been found, they can be executed easily enough. In this example, I produce a list of the commands to run the jobs. I can copy the results out and execute them. select 'exec sp_start_job @job_name = ''' + cast(j.name as varchar(40)) + '''' from msdb.dbo.sysjobs j  join  msdb.dbo.sysjobsteps js on js.job_id = j.job_id join  [ReportServer].[dbo].[Subscriptions] s  on js.command like '%' + cast(s.subscriptionid as varchar(40)) + '%' where s.LastStatus like 'Failure sending mail%'; Another option could be to return the job step commands directly (js.command in this query), but my preference is to run the job that contains the step. Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!

    Read the article

  • print jobs are held until the VirtualBox guest OS is reboot

    - by broiyan
    Here is the setup: VirtualBox 4.1.20 (which the Help window describes as 4.1.12_Ubuntu) Extension Pack 4.1.20 (for USB support) Windows 7 Home Premium as a guest operating system on VirtualBox Ubuntu 12.04 with dist-upgrade's to September 2012 as the host operating system. Fuji Xerox DocuPrint P205b, which I believe is a GDI printer, connected via USB. The problem is that often print jobs will sit in the print queue and nothing comes out of the printer. The printer status for the first item in the queue will be Printing even though nothing happens. Then upon rebooting Windows, the print jobs get printed, seemingly simultaneous to the rebooting process; that is as Windows reloads. One way to avoid this problem is to reboot Windows with the printer cable attached, and then submit the print jobs. The print jobs get printed in a timely manner. Perhaps VirtualBox has a problem with USB being plug-n-play and hot pluggable. It's not convenient to have the printer plugged in when Windows boots because: One, this is a laptop, and Two, I may be boot Windows for a purpose other than printing and not anticipate needing to print. Are there any recommendable fixes for this problem?

    Read the article

  • Steve Jobs élu CEO le plus influent du monde, d'après le top 30 annuel de Barrons

    Steve Jobs élu CEO le plus influent du monde, d'après le top 30 annuel de Barrons Comme chaque année, le magazine financier Barrons publie son top 30 des patrons les plus influents. Et, à son avis, le CEO qui apporte le plus de valeur à son entreprise est Steve Jobs. Le dirigeant d'Apple mène donc le classement. Son nom vaudrait même 25 milliards de dollars ! «Quand il a un souci de santé, l'action Apple tremble», explique le magazine. Steve Jobs aurait même l'aura d'une divinité pour certains, tant ses présentations sont mythiques. L'homme agace ou fascine, mais il ne laisse pas indifférent. Ses détracteurs le disent capable "de faire passer un grille-pain pour la 8e merveille du monde et de persuader les fidè...

    Read the article

  • Are there jobs which are oriented towards optimisation programming or assembly

    - by jokoon
    3D engine programmers have to care a little about execution speed, but what about the programmers at ATI and nVidia ? How much do they need to optimize their driver applications ? Are there jobs out there who only purpose is execution speed and optimisation, or jobs for people to program only in assembly ? Please, no flame war about "premature optimisation is the root of all evil", I just want to know if such jobs exists, maybe in security ? In kernel programming ? Where ? Not at all ?

    Read the article

  • XML pass values to timer, AS3

    - by VideoDnd
    My timer has three variables that I can trace to the output window, but don't know how to pass them to the timer. How to I pass the XML values to my timer? Purpose I want to test with an XML document, before I try connecting it to an XML socket. myXML <?xml version="1.0" encoding="utf-8"?> <SESSION> <TIMER TITLE="speed">100</TIMER> <COUNT TITLE="starting position">-77777</COUNT> <FCOUNT TITLE="ramp">1000</FCOUNT> </SESSION> myFlash //myTimer 'instance of mytext on stage' /* fields I want to change with XML */ //CHANGE TO 100 var timer:Timer = new Timer(10); //CHANGE TO -77777 var count:int = 0; //CHANGE TO 1000 var fcount:int = 0; timer.addEventListener(TimerEvent.TIMER, incrementCounter); timer.start(); function incrementCounter(event:TimerEvent) { count++; fcount=int(count*count/1000);//starts out slow... then speeds up mytext.text = formatCount(fcount); } function formatCount(i:int):String { var fraction:int = i % 100; var whole:int = i / 100; return ("0000000" + whole).substr(-7, 7) + "." + (fraction < 10 ? "0" + fraction : fraction); } //LOAD XML var myXML:XML; var myLoader:URLLoader = new URLLoader(); myLoader.load(new URLRequest("time.xml")); myLoader.addEventListener(Event.COMPLETE, processXML); //PARSE XML function processXML(e:Event):void { myXML = new XML(e.target.data); trace(myXML.ROGUE.*); trace(myXML); //TEXT var text:TextField = new TextField(); text.text = myXML.TIMER.*; text.textColor = 0xFF0000; addChild(text); } RESOURCES OReilly's ActionScript 3.0 Cookbook, Chapter 12 Strings, Chapter 20 XML

    Read the article

  • What is the best way to make a game timer in Actionscript 3?

    - by Nuthman
    I have built an online game system that depends on a timer that records how long it took a player to complete a challenge. It needs to be accurate to the millisecond. Their time is stored in a SQL database. The problem is that when I use the Timer class, some players are ending up getting scores in the database of less than a second. (which is impossible, as most challenges would take at least 11 seconds to complete even in a perfect situation.) What I have found is that if a player has too many browser windows open, and/or a slow computer, the flash game slows down actually affecting the timer speed itself. The timer is 'spinning' on screen so you can physically see the numbers slowing down. It is frustrating that I cannot just open a second thread or do something to allow flash to keep accurate time regardless of whatever else is going on in the program. Any ideas?

    Read the article

  • Is it possible to create a timer in jscript that you can manually change without it being affected by timezones?

    - by Lixorp
    is it possible to create a timer where I can manually set the hours each day to a set number of hours but still remains accurate? For example; if I set the countdown for 5 hours at 2pm I want the timer to stop as soon as it hits 7pm. Also, when I set the timer for 5 hours I would like everyone in the world to see it countdown from 5 hours, no matter what the time is in their country. In the format: days hours minutes seconds. The reason I want to do this is for a streamer's website. He needs a flexible timer which can be manually changed and is the same worldwide for his viewers to know when he starts streaming. The current timer we're using at the moment; setInterval(function(){ var currentTime = new Date(); if(currentTime.getHours() > 19){ var countdownHours = (24 - currentTime.getHours()) + 19; }else if(currentTime.getHours() < 19){ var countdownHours = 19 - currentTime.getHours(); }else{ var countdownHours = 0; } var countdownMins = 59 - currentTime.getMinutes(); var countdownSecs = 60 - currentTime.getSeconds(); $('#countdown-days h1').text('0'); $('#countdown-hours h1').text(countdownHours); $('#countdown-minutes h1').text(countdownMins); $('#countdown-seconds h1').text(countdownSecs); }, 1000); As you can tell it isn't ideal for what we need it for since it counts down to 7pm in the timezone you're in. Any help/examples would be greatly appreciated, Thank you in advance, Lixorp.

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >