dcsimg
A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 24 of 24

Thread: force update during processor intensive routine

  1. #21
    Senior Member
    Join Date
    Jan 2008
    Location
    UK
    Posts
    269
    Ric, updateAfterEvent() doesn't come into play here since the timer itself is the solution to force display. no need to add updateAfterEvent() to the timer event trigger
    That can't be right, can it? I'm sure the timer event doesn't necessarily automatically update the screen in every situation. If it did, then a) there would be no 'updateAfterEvent()' as it would be pointless, and b) you could trigger a timer event every millisecond and force the screen to render at a frame rate of 1000 frames per second - which would be nice!

    I have the 'screen not updating' problem in my current project, where the code goes into a function which does intensive calculations taking between 2 and 5 seconds to complete. I've just double checked, and with a timer event and 'updateAfterEvent()' in it's handler I can update the screen ... but if I get rid of the updateAfterEvent(), the screen is frozen until the calculations are complete.

    Maybe in your case it works without updateAfterEvent() - but I would guess that if the processor intensive function was even more intensive, you might run into the same problem.
    Last edited by _Ric_; 05-03-2009 at 05:40 AM.

  2. #22
    Junior Member
    Join Date
    Apr 2009
    Posts
    11
    nope. didn't work. it shouldn't matter, though. if and event is fired and updated then it shouldn't matter where in the routine flow it is, i would think. it's either updated or not.

  3. #23
    Senior Member
    Join Date
    Jan 2008
    Location
    UK
    Posts
    269
    I'm not sure I quite understand what you mean - but I assume you haven't found a solution yet? Where in your code are you starting the timer? In the processor intensive loop, or before it? I would suggest setting the timer going before the call is made to the processor intensive loop.

    Failing that, split your processor intensive function into smaller sections, spread across different frames, triggering each section with an ENTER_FRAME event. You can set the frame rate to maximum, and the screen will update as it gets to each new frame.

  4. #24
    Junior Member
    Join Date
    Apr 2009
    Posts
    11
    oh... the may 3rd, 9:02 note "nope..." was for beathoven's remark, btw.

    ric, check out the code i posted earlier. that'll show you were i put everything. use loadType to toggle between the "event" and "timer" strategies. the timer event seems to flush whatever's in the queue to be displayed most likely because it's breaking from the init() method calling the processor intensive routines and then coming back.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center