Global timer control

hi all-
I'm writing a video game and I have used timers all over the
place to make everything go. now I want to be able to pause the
game, completely. meaning, I need to stop and start all timer
instances at once, or globally.
so I created a Timer subclass called CustomTimer, put some
statics in there, came up with the attached code. now my problem is
that I'm pretty sure I've created a memory leak, in that the
instances array will just grow and wont allow or gc.
so, my question is, is there an "onDestroy()" method or
somesuch, that I can override, and use that moment to remove
instance refs from the instances array?
or, is there a smarter way to do this? an application object
w/ a pause method perhaps?
thanks

I'm not sure if I understand. You say this: "once the only
ref to the CustomTimer instance is in that array.", but aren't you
adding instances of CustomTimer to the instances array every time
you create a CustomTimer? That's what the CustomTimer constructor
is doing. That would imply that there are multiple instances of
CustomTimer in the instances array.
In any case, you could add this to CustomTimer:
public static function removeTimer(timer:Timer):void
var len:int = instances.length;
for (var i:int; i<len; i++)
if (timer==instances
instances = instances.splice;
return;
}

Similar Messages

  • In need of a global time

    Hi
    I start by making a 1000 frame long comp called "WheelLoop" in which I add a 30 frame Animated file sequence of a 360 degree wheel turn.
    I then add a loopOut Cycle expression to the footage layer so that the wheel keeps turing over and over again for the entire 1000 frames.
    Next I precomp the WheelLoopComp into a new 1000 frame long comp called "Wheelspin"
    From now on I can controll the exact point of the wheel turn in time via a TimeRemap on the WheelSpin comp.
    E.g. If I set the time remap to 30 frames the wheel has turned once, and at 120 fr. it has turned four times.
    Next I go on with my comp work and end up having burring this WheelSpin comp way down in precomps with all sorts of starting point offsets to the.
    now when I am stading in the TopLevelComp at frame 120 I can no longer be sure that the wheel has turned four times, cause of all the layer starting points offsets.
    What I would like is to go down the line into the WheelSpin comp and have the TimeRemap refer to the "Global time" (or Top Comp Time) regardless of any offsets up the line in the different layes that holds the WheelSpin Comp.
    The result should be so that when I tell the WheelSpin Comps TimeRemap to be at frame 120 from the TopLevel Comp, the Wheel should have turned exactly four times regarless if some of the Comp thats holds it might have a different starting points.
    To do this I feel I need a Global time.
    E.g. go into the TimeRemap of the WheelSpin Comp and add an expression " comp("TopLevel").time "
    Is this in anyway possible?
    Thanks in advance

    Try replacing your loopOut() time remapping expression with this one:
    period = key(numKeys).time - key(1).time;
    time%period
    Dan

  • Time controlled processing

    Hello All.
    My process consists in creating a text file contaning information of many idoc generated on R3 side.
    I know SAP R3 can send idoc in packs but I don't want my messages to be too big => Thus, Idoc Pack size won't be higher than 100.
    Every day, I will send my packs of idoc to XI in order to create the outbound file.
    With one pack of Idoc no pb but how can I do to create only one file when I would have more than one pack
    I want to know if it is possible without using BPM to build one file at a determined,scheduled moment with all received and not already processed idocs and how ?
    I found in documentations the possibility to maintain filters for time controlled processing (SXMB_ADM).
    Do someone have links about it or explain me the global steps to do what I want.
    Thanks very much

    hi,
    I'm not sure if you understood it correctly
    IDOC packects from R3 are not received as packets in XI
    they are received as one by one...
    so you need a BPM to collect them (to any number you want) anyway
    and BPM gives you many possibilities of telling
    when to stop and then when to create the file...
    Regards,
    michal

  • How can I design a time controlled applicatio​n

    I want to build a time controlled VI which can provide chemical actions e.g. to open or close valves etc. The duration of the actions, the steps are written down in a spreadsheet e.g. from 0...1 min open valve A, from 1...10 min open valve B etc. The user should have the possibility to pause the run and resume at the same point. Can someone help me to find the most effective way to solve this problem? Thanks Ruediger (I use LV 6.0 on NT4)

    I have a simple example that I had been working on. I made a couple modifications based on what you described. Check this out and see if it helps.
    Attachments:
    tank_fill.zip ‏20 KB

  • How to make users to select the date from calendar control my making the date field read only in date time control in external list in sharepoint 2010

    How to make users to select the date from calendar control only, by my making the date text field read only (don't want to let users type the date) in date time control in external list in sharepoint 2010. I am looking for a solution which can
    be done through sharepoint desginer / out of the box.
    thanks.

    Congratulate you got the solution by yourself. I am new to a
    WinForms calendar component, I feel so helpless on many problems even I'd read many tutorials. This question on the
    calendar date selection did me a great favor. Cheers.

  • SharePoint 2013 RSS Viewer not loading when other Custom web part using Update Panel or Ajax Timer control

    Hi,
    SharePoint 2013 RSS
    Viewer web part failing to complete loading when the page loads.
    This happens when having RSS Viewer and then adding a Custom webpart with an updatepanel and timer control.
    I  had used Ajax update panel and timer control to load the web part asynchronously after the main page is fully loaded.
    The RSS-Viewer web part hangs in loading state while the custom webpart loads just fine.
    The issue occurs when an like button click or Timer Tick event fires after the page
    is loaded.
    Haven't been able to track the issue.
    Couple of workaround I tried to call a server side button click event from the custom web part after the page gets fully loaded using JQuery shown below did not work out either.
     $(document).ready(function () {
                $('#<%= netButton2.ClientID %>').click();
    And 
    document.onreadystatechange = function () {
                if (document.readyState == "complete") {
                    $('#<%= netButton2.ClientID %>').click();
    Please let me know how to resolve this issue.
    Thanks,
    Franklin

    Hi Johan,
    The assignment of this user on the given task might be corrupted. Try to remove the resource from the task, publish the project, assign the resource again and publish again the project. If it is not working, try to unpublish the task (column "publish")
    and publih it again.
    Hope this helps,
    Guillaume Rouyre, MBA, MVP, P-Seller |

  • Date and time control panel crashing

    why is date and time control panel crashing?

    I haven't noticed that in iCal. I don't normally use a 24 hour clock.
    Glad to help on the other, though.
    Why reward points?(Quoted from Discussions Terms of Use.)
    The reward system helps to increase community participation. When a community member gives you (or another member) a reward for providing helpful advice or a solution to their question, your accumulated points will increase your status level within the community.
    Members may reward you with 5 points if they deem that your reply is helpful and 10 points if you post a solution to their issue. Likewise, when you mark a reply as Helpful or Solved in your own created topic, you will be awarding the respondent with the same point values.

  • Using multiple charts but one time control

    I would like to place two charts on the same web page.  One above the other.  The top chart will have the time refresh control on it while the other should be controlled by the first chart.  I have recently taken two charts and controlled each of them by using an iBrowser.  How do I get the time features to sync up with the other chart?

    In chart #2, turn off the "Show Time Control" checkbox in the display template.
    In the update event from chart 1, set the startdate/enddate of chart 2 to the startdate/enddate of chart 1, and call the updateChart(true) method of chart 2.
    Pseudocode (might be a few typos):
    chart2.getQueryTemplate().setStartDate(chart1.getQueryTemplate().getStartDate());
    chart2.getQueryTemplate().setEndDate(chart1.getQueryTemplate().getEndDate());
    chart2.updateChart(true);
    Best regards,
    Rick

  • Time controlled Loop faster than 1ms

    HI
    I work with Labview 8.2.1.
    I need a time controlled loop who is faster than 1ms. I tried to use the 1MHZ time source (see picture) but the loop does not work with this.
    Please help
    Message Edited by SteffenGrab on 11-30-2007 01:13 PM
    Message Edited by SteffenGrab on 11-30-2007 01:17 PM
    Attachments:
    Time loop.JPG ‏66 KB

    There is no picture to see...
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness

  • Time Controlled digital line PXI-6251

    Hi,
    I need to create a time controlled boolean.
    For example a digital line is set to False. I'd like to change to True status for a certain amount of time (e.g. 150ms).
    Is it possible with PXI 6251?
    Thanks

    Hi,
    yes you can. Set a buffered digital output task like "Digital - Finit Output.vi" example.
    You can use an external clock, generate it throught counter output or use ananog in/out sample clock.

  • Shutdown time controlled

    Hello guys,
    so far I shutdown my machine via shutdown -h +time when I want to terminate it time controlled. But often there are still some programs running like firefox. Is there any program-friendly method to shutdown?
    shutdown -h kills all apps instantly without terminating them correctly.
    Best regards

    From the man page,
    shutdown  brings  the  system down in a secure way.  All logged-in
           users are notified that the system is going down, and login(1)  is
           blocked.   It  is  possible to shut the system down immediately or
           after a specified delay.  All processes are  first  notified  that
           the  system  is going down by the signal SIGTERM.  This gives pro‐
           grams like vi(1) the time to save the file being edited, mail  and
           news  processing programs a chance to exit cleanly, etc

  • Time Controlled Loop?

    I am building an application that scrolls through an panoraminc photo to make it appear as if its rotating 360 degrees.
    So far i can get the image to scroll left and right continously by having a left and right button to click on
    what i am after is some ideas/direction on how i could automate the process, as in when you click the left button the image will scroll at a certain speed.
    I was thinking that i would need a time controlled loop where the the method for scrolling the image to the left occurs every few seconds.
    Thanks in advanced

    Use a inner class that extends Thread as follow:
    class MyTimer extends Thread{
    boolean continue=true;
    public void stopScroll(){
    continue=false;
    public void run(){
    while(continue){
    try{
    xpos=pictureScroll(img, xpos, "right");
    sleep(100);
    }catch(InterrupdedException e){
    }use
    Thread t=new MyTimer ();
    t.start();to start scroll, and to stop
    t.stopScroll();in button's ActionPerformed

  • Real time control application

    I am going to use NI PXI-6070E for real-time control application, can someone provide sample programme for me?
    Thanks a million!

    Many examples can be found in the LabVIEW Example finder (Help->Example finder), in the ...Programme\National Instruments\LabVIEW 7.1\examples directory or on ni.com, e.g. here are some RT examples:
    http://zone.ni.com/devzone/devzone.nsf/webproducts/c25f8c664230613a862567df006abb06?opendocument
    The 6070 is only a multifunction DAQ card, you still need a RT controller, e.g. the 8187:
    http://sine.ni.com/apps/we/nioc.vp?cid=13981〈=US
    Kai Kratt

  • RoboHelp 8 crashes when clicking See Also tab of Design-Time Control Properties

    My project was previously in RoboHelp 7 and is a merged project. I copied a topic with see also buttons and want to edit the links. I right click the button and select Design-Time Control [name] Properties and click the See Also tab. RoboHelp crashes every single time. Error message:
    EventType : BEX
    P1 : RoboHTML.exe
    P2 : 8.0.0.203
    P3 : 4944f3bb
    P4 : CLIENTMONTEREYDB.dll
    P5 : 8.0.0.203
    P6 : 4944e14d
    P7 : 000016aa
    P8 : c0000409
    P9 : 00000000
    One thing that is a little strange is that some of the buttons have Design-Time Control [object1] Properites and some have Design-Time Control [RelatedTopic] Properties, but all have the See Also tab.
    If I insert a new See Also button using Insert > See Also, the menu choice is Design-Time Control [See Also] Properties and the tab is See Also. Click the tab and RoboHelp crashes.
    If I insert a new Related Topics button using Insert > Related Topics, the menu choice is Design-Time Control [Related Topic] Properties and the tab is called Related Topics. Click the tab and RoboHelp does not crash.
    I have a whole lot of these buttons I need to modify, so I'd appreciate if anyone knows of a solution to this problem.
    Sample HTML for an offending button:
    <!--Metadata type="DesignerControl" startspan
    <object classid="clsid:A2F1FA63-C1E6-11d2-9140-006DC83B9955" border="0"
             id="object1" style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px;
             margin-right: 0px;" align="bottom">
    <param name="_Version" value="65536"  />
    <param name="_ExtentX" value="1720"  />
    <param name="_ExtentY" value="582"  />
    <param name="_StockProps" value="13"  />
    <param name="ForeColor" value="0"  />
    <param name="BackColor" value="12632256"  />
    <param name="UseButton" value="-1"  />
    <param name="UseText" value="0"  />
    <param name="ControlLabel" value="See Also"  />
    <param name="UseIcon" value="0"  />
    <param name="Items" value="ChgSubErrSeverity - see also$$**$$"  />
    <param name="Image" value=""  />
    <param name="FontInfo" value="Verdana,8,0,,BOLD"  />
    <param name="_CURRENTFILEPATH" value="C:\DocsClassic\CARS-Maintenance\HelpSourceZip313\carsis\Changing_Submission_Error_ Severity.htm"
      />
    <param name="_ID" value="object1"  />
    <param name="DialogDisplay" value="1"  />
    <param name="Frame" value=""  />
    <param name="Window" value=""  />
    <param name="ChmFile" value=""  />
    <param name="DisableJump" value="0"  />
    </object>-->
    <object
      classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"
        type="application/x-oleobject">
      <param  name="Command"  value="ALink,MENU" />
      <param  name="Button"  value="Text:See Also" />
      <param  name="Font"  value="Verdana,8,0,,BOLD" />
      <param  name="Frame"  value="" />
      <param  name="Item1"  value="" />
      <param  name="Item2"  value="ChgSubErrSeverity - see also" />
    </object>
    <!--Metadata type="DesignerControl" endspan-->

    Hello again
    Bummer that!
    First, I'll answer something I failed to earlier. You said that sometimes it says SeeAlso and sometimes it's object1. Here's the deal on that.
    When you click Insert > See Also the first time in a topic, the control is named SeeAlso. If you copied and pasted or clicked Insert > See Also again, the first time you did that it would be object1 or OBJECT1 depending on whether you used the menu or you copied and pasted. This is because each of these must use a unique name. So is it possible that you disliked seeing object1 on some and you renamed so the second (or third) also was named SeeAlso? I could see that causing RoboHelp to gag.
    Assuming that's not it, what about topic filenames or titles? Do any of them have unusual characters in the names? Any character other than 0-9, a-z, A-Z or an underscore ( _ ) is suspect. Perhaps an odd character is tossing a monkey wrench into the works.
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7, 8 or 9 within the day!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

  • Key control of the time control

    What I really like about the time control that it is so easy to set
    using the arrow keys on my keyboard. Unfortunately this doesn't seem to
    work with the minutes and seconds. Anyone have an explanation for this?
    Using 7.1 on XP.

    I learned some more: as you all know a "value change" event in most
    controls fires after editing when pressing enter or clicking outside of
    the control. The same is the case when typing inside the time control.
    But using the arrow keys in the time control is another animal: every
    key press fires a "value change" event. This explaines some of the odd
    behaviour: when you manually enter a value, the control is in edit
    mode. The entered value will only stick when you invoke the "value
    change" event. Because the edit mode the arrow key value change event
    cannot operate. Why it cannot operate in all "lower" fields is strange
    to me. Since every field can be changed independently inside one
    control, every field can invoke the value change event invoked by the
    arrow keys. When invoked in a "higher" field, it will override the edit
    mode in a lower field. After all, you cannot edit multiple fields at
    once.

Maybe you are looking for