3 Replies Latest reply on Jun 24, 2006 10:46 PM by VooDoo Chicken

    preloader for external swf

    VooDoo Chicken Level 1
      first try, changed somethings from previous post, tried to make different changes, instead of using if else tried to set an onload handler both before and after the loadmovie sentence (not at the same time of course), copy paste of what goes on each frame (actionscript 1):

      frame 1:

      setProperty("", _focusrect, false);
      Stage.showMenu = false;
      fscommand("showmenu", "false");
      fscommand("allowscale", "true");
      var mensaje = "0 %";
      this.createEmptyMovieClip("pantalla", 0);
      pantalla._x = 0;
      pantalla._y = 0;
      loadMovie("centrino2x.swf", "pantalla");


      frame 2

      mensaje = (pantalla.getBytesLoaded()/pantalla.getBytesTotal())*100;
      mensaje = Math.round(mensaje)+" %";
      play();

      frame 3

      if (pantalla.getBytesLoaded()==pantalla.getBytesTotal()) {
      nextFrame();
      } else {
      prevFrame();
      }


      frame 4:

      pantalla.swapDepths(0);
      pantalla.play();
      stop();


      the result: the if else goes right by to next frame, so it jumps as if the movie was whole loaded, remaining in last frame as a blank screen till the movie loads. the message appears as 100% in the half a sec it gets on screen. according to trace, bytes loaded and bytes total = 0


      version 2, i nearly copied it from a tutorial linked from another post, most of the preloader stuff is nearly exact from the tutorial, uses movieloader class (actionscript 2)


      frame 1:

      setProperty("", _focusrect, false);
      Stage.showMenu = false;
      fscommand("showmenu", "false");
      fscommand("allowscale", "true");
      var mensaje = "0 %";
      this.createEmptyMovieClip("pantalla", 0);
      pantalla._x = 0;
      pantalla._y = 0;
      //
      var cargador:MovieClipLoader = new MovieClipLoader();
      var control:Object = new Objetc();
      //
      control.onLoadProgress = function(target, loaded, total) {
      aviso.text = Math.round((loaded/total)*100)+" %";
      }
      control.onLoadInit = function () {
      nextFrame();
      }

      cargador.addListener(control);
      cargador.loadClip("centrino2x.swf", pantalla);
      //
      stop();


      frame 2:

      pantalla.swapDepths(0);
      pantalla.play();
      stop();

      the result: it never changes frame (as if it never finishes loading), message giving percentage loaded never appears, and traces on event handlers for listener never come out

      i have no idea what %$#"&#" is wrong, i have spend quite a time on this, which at first seemed like the easiest part, any pointers?