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


Reply via email to