3 Replies Latest reply on May 9, 2009 5:14 PM by Ned Murphy

    Preloader scene causing problems with main movie scene

    Mister.Tibbs

      Hi

       

      Hope someone can help as my knowledge of actionscript is limited at best.  I can get by and make nice flash sites, but I'm still learning what goes where and am still borrowing code to get by.  I've laid the problem out in some detail as I am sure that will save a lot of questions later on, but feel free to ask if you want more info.  Problem is as follows:

       

      I've built a two scene flash site using open source code for the preloader scene:

       

      myLoaded = Math.round(getBytesLoaded());

      myTotal = Math.round(getBytesTotal());

      myPercent = myLoaded/myTotal;

      myBar._width = myPercent*150;

      myText = Math.round(myPercent*100)+"%";

      if (myLoaded == myTotal) {

          gotoAndPlay("Home", 1);

      (3);

      } else {

          gotoAndPlay(1);

      }

       

      I've also used open source for the scrolling menu in the main scene - this code for the scrolling menu sits in a timeline layer that covers the full stretch of the timeline.  It allows the user to click any button and move backwards or forwards along the timeline to a timeframe designated by the button pressed:

       

      function Movement() {

       

      if (_root._currentframe > _root.mytarget){

      prevFrame();

       

      }else if (_root._currentframe < _root.mytarget){

      nextFrame();

       

      }else{

      stop();

      }

       

      }

       

      this.onEnterFrame= Movement;

       

      The buttons on the scrolling menu contain code like this:

       

      on(Press){

      _root.mytarget=21;

      }

       

      The main scrolling menu scene works great when it's a one scene movie and the preloader code works fine with a load of other sites I've built, but when I put them together on this site (the code for the scrolling menu precludes the addition of a preloader directly into that scene so separate scenes are a necessity) everything goes to pot.  When testing the site (both as a standalone SWF file and when embedded in an HTML file) the preloader works fine and the main scene appears correctly, but when you click on any button to move back or forth along the menu/timeline it jumps and jerks along very roughly and stops short of its designated point.

       

      This causes the whole scene to fail as the designated timeframe for each button contains a movie instance that won't function until the specific timeframe is reached.  It's odd behavior and I'm stumped as both chunks of code work fine separately.  I've even tried a much simpler preloader that doesn't display percentage or anything, it just cycles between frame one and two until the movie loads and then plays it (just like this one, but with no bells or whistles).  Unfortunately my lack of actionscript knowledge prevents me from even finding a simple term to sum up the problem so I've failed to find any similar issues on any forums or Google.

       

      You can view both versions (with and without the preloader) at the following links:

       

      http://www.niallsingers.co.uk/scm/withoutpreload.html

      http://www.niallsingers.co.uk/scm/withpreload.html

       

      Any advice or insight will be most welcome.

       

      Thanks,

      Niall.