A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: preload breaks _lockroot?

  1. #1
    Member
    Join Date
    Mar 2000
    Location
    Atlanta
    Posts
    83

    preload breaks _lockroot?

    I have a game that gets loaded into an interface shell. On the first frame of my game I have this._lockroot = true.

    So far in developmet this has been working perfectly. But now an issue has come up.

    In the loader of the shell, an empty movieclip is created to preload the game (and the shell). When the game is finished loading, the movieclip created for the preload is destroyed (removeMovieClip) and the shell continues and does some other stuff and then the game is loaded later on into another preplaced movieclip.

    Now the game's _lockroot doesn't work.

    I have tried many things when destroying the preloaded clip (removeMovieClip, unloadMovie, delete, etc.) and still it doesn't work. Comment out the preloader for the game and everything works fine.

    What's going on?

    brad

  2. #2
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    did you use loadMovieNum or loadMovie on the movie clip ya removed? first guess is that the lockroot is in the timeline of the movieclip you removed, or you used loadMovieNum and targetted that level on accident.

  3. #3
    Member
    Join Date
    Mar 2000
    Location
    Atlanta
    Posts
    83
    Definitly not loadMovieNum, I can see the game loading into the correct clip off stage.

    first guess is that the lockroot is in the timeline of the movieclip you removed
    So... does this mean only one movieclip can have _lockroot? The lockroot command is in my actualy game. If this is the case how can I clear the preload MC's ownership of the only lockroot? I have tried:

    _root.gamePreLoad_mc._lockroot=false;
    and
    _root.gamePreLoad_mc.unloadMovie();
    and
    _root.gamePreLoad_mc.removeMovieClip();
    and
    _root.createEmptyMovieClip("gamePreLoad_mc", 5); //overwrite original

    and every combination/permutation of the above.

    before I remove the clip. I have also tried only setting _lockroot=true in my game if the _parent movie is not in a preload state.

    I just can't get this to work.

  4. #4
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    aha! i think i see your problem

    you're trying to call lockroot from the main swf and targetting the loaded swfs... maybe this works (but it's not looking like that's the case, i certainly have never seen it that way)... anyhow, in each swf that you want _lockroot to be set on, put in the first frame

    Code:
    this._lockroot = true;

  5. #5
    Member
    Join Date
    Mar 2000
    Location
    Atlanta
    Posts
    83
    you're trying to call lockroot from the main swf and targetting the loaded swfs... anyhow, in each swf that you want _lockroot to be set on, put in the first frame
    I am setting _lockroot on the first frame of my game that gets loaded in, not from the main swf. So I am already doing what you are suggesting.

    I have tried setting the _lockroot many different ways (from the loader swf, from the loader swf on the target mc, etc.) and nothing is working.

    brad

  6. #6
    Member
    Join Date
    Mar 2000
    Location
    Atlanta
    Posts
    83
    Issue Resolved.

    In my game.swf I have an imported class.(I moved my import statement around apparently it makes no difference whre it is.)

    import Game;

    though my Game is not instantiated yet, this was causing the issue.

    So after preloading the game in the loader movie:

    delete Game; //this fixed it
    gamePreLoad_mc.unloadMovie();
    gamePreLoad_mc.removeMovieClip();

    So yeah, there you go anyone else who runs into this issue.

    brad

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