gotoAndStop on main timeline from package / class

Hi all,

Just signed up here. I’ve been having a problem for quite some time now. I’ve searched Google a lot (as well as here) and I can’t seem to solve my problem. If this has been covered a thousand times, my apologies.

Some background: my Flash file should be usable only to logged-in users. So I pass the session ID via the params and then send out a request using URLLoader to make sure it’s valid, the user has permissions, etc. The (e.g.) package that does that is this:

package {
 import flash.display.Sprite;
 import flash.display.MovieClip;
 import flash.events.Event;
 import flash.net.URLLoader;
 import flash.net.URLRequest;
 import flash.events.IOErrorEvent;
 public class MyClass extends Sprite {
 
  private var loader:URLLoader;
  private var request:URLRequest;  
  public function MyClass(str:String) {
   request = new URLRequest(str);
   loader = new URLLoader();
   try {
    loader.load(request);
   } catch (error:SecurityError) {
    trace("A SecurityError has occurred.");
   }
   loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
   loader.addEventListener(Event.COMPLETE, loaderCompleteHandler);
  }
  
  private function loaderCompleteHandler(event:Event):void {
   MovieClip(TopLevel.root).gotoAndStop("Must Be Logged In");
  }
  private function errorHandler(e:IOErrorEvent):void {
   trace("IE Error");
  }
 }
}

And, my TopLevel class is (h/t senocular):

package {
 
 import flash.display.DisplayObject;
 import flash.display.MovieClip;
 import flash.display.Stage;
 
 public class TopLevel extends MovieClip {
  public static var stage:Stage;
  public static var root:DisplayObject;
  public function TopLevel() {
   TopLevel.stage = this.stage;
   TopLevel.root = this;
  }
 }
}

I’ve tried the stage.dispatchEvent() and, as you can see above, the gotoAndStop(). Nothing seems to work. Also, I’m not using Scenes - I’m using Frame Labels. Any help?