5 Replies Latest reply on Oct 10, 2007 1:34 PM by kglad

    Very simple preloader - does it really works?


      I have a full flash site done and I'm desperate 'cause the only thing missing is a preloader (the site has 500kb).

      I tried everything but without any sucess. A preloader was a very simple thing to do in AS2, but it's killing me in AS3.

      A few things you should know:

      - I'm not using any frames at all, none.

      - The preloader method I'd like to use is the one that works:P


      At the moment I have a very simple preloader within the swf I want to preload, here's the code:

      var _loaderBar:Sprite = new Sprite;

      public function main(): void{

      public function preloader(): void{
      addEventListener(Event.ENTER_FRAME, loading);

      private function loading(event:Event) {
      var bytestotal = stage.loaderInfo.bytesTotal;
      var bytesloaded = stage.loaderInfo.bytesLoaded;
      var sclbar = Math.round(bytesloaded*100/bytestotal);
      if (bytesloaded >= bytestotal) {
      removeEventListener(Event.ENTER_FRAME, loading);

      The code above loads all the 500kb before it starts playing, but I read somewhere that a preloader within the code/swf is really a problem in IE6/7, and I don't know how to apply any hacks to solve it.

      I tried already to load the index.swf externaly, but even with a nice and good preloader, I always have some problems with the loaded movie, specifically with the display object (Error #1009: Cannot access a property or method of a null object reference) and the code is about 400 lines so detecting where the problem is isn't easy for me.

      So, my question is: Is the code above a good way to load my code? does is really works?

      Does anyone has a better solution?

      Sorry if this subject is already been discussed but I'm really lost here.

      Thanks in advance.