1 Reply Latest reply on Oct 14, 2006 4:05 PM by Star_Tail_Pro

    Coding issues

    space21uk
      I have added this code to my button that controls a small audio file, my problem is that when you click play, it starts to play for a quick second, cuts off and then plays the whole file. I have just added a very small part of the song as i am still testing the site.
      if you wish to see what i mean please click on the below link and then go to production.
      Can i also ask, when you log onto the site, while it is loading a white screen appears then disapers when loaded!!!
      Anyone know why this is, and what can i do to make it go away?

      http://www.phuture-elements.com

      on (release) {

      //Load Streaming mp3 behavior
      if(_global.Behaviors == null)_global.Behaviors = {};
      if(_global.Behaviors.Sound == null)_global.Behaviors.Sound = {};
      if(typeof this.createEmptyMovieClip == 'undefined'){
      this._parent.createEmptyMovieClip('BS_lost',new Date().getTime()-(Math.floor((new Date().getTime()) /10000)*10000) );
      _global.Behaviors.Sound.lost = new Sound(this._parent.BS_lost);
      } else {
      this.createEmptyMovieClip('_lost_',new Date().getTime()-(Math.floor((new Date().getTime()) /10000)*10000) );
      _global.Behaviors.Sound.lost = new Sound(this.BS_lost);
      }
      _global.Behaviors.Sound.lost.loadSound(" http://www.phuture-elements.com/lost.mp3",true);

      }



      Now a small preloader problem, i made a preloader and put it onto scene 1, then once data is loaded it plays from scene 2, frame 1. My issue is that it seems to add longer for the site to load and also, the preloader does not imdeiately start playing when you type in the URL and wait. You still get the small bar from the normal windows loading status, one at bottom right of page, then 3/4 way through the preloader plays for a quick second then loads the home page which is correct but most sites in flash immediately play the prelodader while loading the site.
      Here is a small part of my code

      //setting up variables to display
      //percentage loaded in the text box.
      loaded_bytes = Math.round(_root.getBytesLoaded());
      loaded_total = Math.round(_root.getBytesTotal());
      total_percent = (loaded_bytes/loaded_total)*100;
      _root.loaded_text = Math.round(total_percent);
      //We apply the code to make the text change its
      //X position according to the position of progress
      //bar.
      startpoint = bar._x
      _root.text._x = startpoint + (_root.bar._currentframe*2.5);


      i then have the small tween play and

      gotoAndPlay("Scene 2", 1);


      any ideas on what im doing wrong
        • 1. Re: Coding issues
          Star_Tail_Pro Level 1
          from first glance i would say its the music downloading. I think you should look around on preloading sound files, becaus they can be quite sneaky as they are not apart of the intual download, wait... thats if the file is inside flash, sorry, but it still a good idea to make a sound preloader, so do some googling and see what you find.

          Your preloader, i have seen before. I had the same problem. Hopefully your using AS2 not sure on AS3 but going in to the publish settings, next to the actionscript version there is a button saying "settings", click on it and another window will open. Inside there should be somethinf like Export AS2 classes and a number. Change the number to the fram after your preloader. You should put a blank keyframe after the last frame of your preloader. The goto bit won't need to change as it will all be loaded. So when it gets to the end of your preloader and goes to scene 2 frame 1 the classes will be loaded.

          I hope all this made sense :/