[flexcoders] Re: Timers Not Firing

2007-02-27 Thread norealnamesleft
I had some weird deal where I had 2 timers calling the same
EventHandler (copy and paste mistake) and even though i stopped both
Timers one kept going

Not that this is optimal but I would try offsetting your Timers 100,
101, 102, etc and see if that works or running one function and using
removeEventListener (although that may throw an exception?).


--- In flexcoders@yahoogroups.com, Daniel Thompson [EMAIL PROTECTED] wrote:

 So, I tried to post this over to Flashcoders, but something funky is
going
 on over there. I would like to try here, as it is an ActionScript 3
 question, and I think the people here may be able to help. However,
this is
 just an ActionScript project for now (hopefully, not for long).
 
 I posted earlier about timers going wonky when I tried to disable my
 application. I was attempting to remove all the display list items
and then
 reinstantiate them later. I'm no longer trying to do that, but still am
 having problems when I come back to this window, to get the timers
to start
 up again.
 
 When I set a breakpoint in the classes' load() method, I see the
timer being
 instantiated and set and told to run. The first time I load the class,
 everything works fine. When the user clicks the expand button and
opens up
 another window, the class runs an unload method which stops the
timers. When
 you come back to the window, I can see the very same breakpoint hit that
 sets up the timers and calls start. This time, however, the timers don't
 fire.
 
 I've been working several days now trying to get around this; any
and all
 advice/help is greatly appreciated. I have tried creating the timers
in the
 constructor (I may try that again just for good measure), I've tried
 resetting the timers... I've tried setInterval. Nothing is working
for me.
 
 Should I post this to Flexcoders? There is (of course) more AS3
stuff going
 on over there. I'm not using Flex, though... just ActionScript 3.
 
 
 
 public override function load():void {
   if (!_initialized) {
 
 // I'll set a breakpoint around here and it will hit every time.
 // But after unload is called, none of the timer handlers will 
 // ever be invoked.
 
 _playbackTimer = new Timer(100);
 _playbackTimer.addEventListener(TimerEvent.TIMER,
 playbackTimerHandler);
   
 _progressTimer = new Timer(100);
 _progressTimer.addEventListener(TimerEvent.TIMER,
 progressTimerHandler);
 
 _loadCheckTimer = new Timer(100);
 _loadCheckTimer.addEventListener(TimerEvent.TIMER,
 loadCheckTimerHandler);
 _loadCheckTimer.start();
   
 _stateTimer = new Timer(100);
 _stateTimer.addEventListener(TimerEvent.TIMER,
stateTimerHandler);
 _stateTimer.start();
   
 _statusTimer = new Timer(1000);
 _statusTimer.addEventListener(TimerEvent.TIMER,
statusTimerHandler);
 _statusTimer.start();
 
 _queueLoad = true;
 
 return;
   }
   ...
 }
 
 public override function unload():void {
   if (_progressTimer != null  _progressTimer.running) {
 _progressTimer.stop();
   }
 
   if (_playbackTimer != null  _playbackTimer.running) {
 _playbackTimer.stop();
   }
 
   if (_stateTimer != null  _stateTimer.running) {
 _stateTimer.stop();
   }
 
   if (_statusTimer != null  _statusTimer.running) {
 _statusTimer.stop();
   }
   
   ...
   
   _initialized = false;
 }
 
 
 Thanks,
 -DT





RE: [flexcoders] Re: Timers Not Firing

2007-02-27 Thread Daniel Thompson
Thanks norealnamesleft. I think it's turning out to be a bug in the Flash
player. In 9r28 the timers start firing again; in 9r16 (or 9r15...), they do
not.

Thanks,
-DT


 -Original Message-
 
 I had some weird deal where I had 2 timers calling the same
 EventHandler (copy and paste mistake) and even though i stopped both
 Timers one kept going
 
 Not that this is optimal but I would try offsetting your Timers 100,
 101, 102, etc and see if that works or running one function and using
 removeEventListener (although that may throw an exception?).
 

  This time, however, the timers don't fire.