A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: Help....Preloader external swf files

  1. #1
    Senior Member Da enforcer's Avatar
    Join Date
    Aug 2002
    Location
    England
    Posts
    238

    Help....Preloader external swf files

    Hey Guys

    I have a swf that calls in external swf files. The preloader works fine on the main swf.

    On the external swf files I have also used the code for the preloader so when the main swf pulls in the external file that file preloads itself.

    here is the code:

    this.onEnterFrame = function() {
    var amount:Number = this.getBytesLoaded() / this.getBytesTotal() *100;
    preloader._xscale = amount;
    if(amount == 100) {
    this.gotoAndPlay(3);
    delete this.onEnterFrame;
    }
    }

    The issue im getting is that the preloader on the external files dont seem to work at all. I get a black screen until the movie loads.

    Any ideas anyone?

    Thanks

  2. #2
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    I am note quite sure where the problem is with your code. I use a similair method myself.
    Code:
    var bytetotal = this.getBytesTotal();
    var ready = 0;
    this.onEnterFrame = function() {
    	var byteload = this.getBytesLoaded();
    	ready -= (ready - (byteload / bytetotal) * 100) * .25;
    	var output = Math.ceil(ready) + " % ";
    	txTitle.text = output;
    	if (Math.ceil(ready) == 100) {
    		delete this.onEnterFrame;
    		txTitle.text = "";
    		gotoAndStop(2);
    	}
    };
    stop();
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  3. #3
    Senior Member Da enforcer's Avatar
    Join Date
    Aug 2002
    Location
    England
    Posts
    238
    Yeah this is what is doing my head in....My external files dont preload when being called into the main swf....but they do preload if i test the files on their own through flash preview :/

  4. #4
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    Can you post the fla?
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  5. #5
    Senior Member Da enforcer's Avatar
    Join Date
    Aug 2002
    Location
    England
    Posts
    238
    I'm afriad the project is over 100mb's so its not going to be possible im afriad.

    I guess that aint going to help matters lol

    any chance u could do a test for me with 2 swf and one calling the external one in with a preloader?

    I know im asking alot but im in a bit of a spot and have hours to get this done

    thanks very very much

  6. #6
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    No need to test i know it works, thats why i need to see the fla.
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  7. #7
    Senior Member Da enforcer's Avatar
    Join Date
    Aug 2002
    Location
    England
    Posts
    238
    could it be that fact that im using a loader from the flash components to bring in my external swf files?

  8. #8
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    How do u mean?
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  9. #9
    Senior Member Da enforcer's Avatar
    Join Date
    Aug 2002
    Location
    England
    Posts
    238
    Well i have never used external swf files in flash before.

    So i used the loader componant in flash and directed it towards the swf.

    Could that be why the external file dont preload? Am i importing external files wrong maybe>

    Sorry bit of a noob at this

  10. #10
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    I have no idea of your setup so couldn't honestly say yes or no.

    I have attached a file with fla1(main) fla2(to be loaded into main)
    The fla's do exactly what they are supposed to.
    file
    Hope it helps
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  11. #11
    Senior Member Da enforcer's Avatar
    Join Date
    Aug 2002
    Location
    England
    Posts
    238
    You are a legend mate...Changing the way I bring in the swf files worked a treat!!

    I knew it must be something to do with that...the code looked all right to me for the preloader.

    Thanks very much for doing that for me

  12. #12
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    Ah ha no problem
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

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