A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Access variable in MainTimeLine

Threaded View

  1. #1
    Join Date
    Aug 2008

    Access variable in MainTimeLine

    I have preloader that loads another swf, game.swf.

        // this code is in the preloader
        var appRoot="localhost";
        // load game
        var request:URLRequest = new URLRequest("game.swf");
        var _loader:Loader = new Loader();
          _loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
          _loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded);
    How can I access preloader's variable from game.swf?

        //this code in the game
        var m:MovieClip = MovieClip(root);
        trace ("m.appRoot=" + m.appRoot);
    This gives error: m.appRoot=undefined...
    Also "(root as MovieClip).appRoot" gives me the same error.
    Why can't I have access to MainTimeLine's variables?
    Last edited by panoss; 05-04-2015 at 05:58 AM.

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