dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Access variable in MainTimeLine

Threaded View

  1. #1
    Member
    Join Date
    Aug 2008
    Posts
    38

    Access variable in MainTimeLine

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

    Code:
        // 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);
          _loader.load(request);
    How can I access preloader's variable from game.swf?

    Code:
        //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