dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: question re: preloading in inner movies

  1. #1
    Senior Member
    Join Date
    Mar 2003
    Posts
    316

    question re: preloading in inner movies

    Hi,

    got a question rereloading .. I know there are tons of examples and I have most of them =) but I am still having problems understanding some concepts and actually getting my preloaders to work properly. First of all I have a main movie that loads movie called "Studio", then inside my (externally loaded swf file) studio.swf I am doing more preloading of some jpg images ... preloading works fine for all my root movies but seems to have problems once used in inner movies. One of the problems is once loading my "studio" it finishes loading sits on 100% for a while then loads after what could be causing this? Same thing happens if I reuse the preloader for the jpg images (is there a bette way to preload each jpg image there is a lot of them) that I am loading in "studio" they sit on 100% for ages before actually showing up ??? Any ideas or nice code that could solve it?

    //frame 1
    onClipEvent (load) {
    _xscale = 0
    tot = _root.content.getBytesTotal();
    }
    onClipEvent (enterFrame) {
    car = _root.content.getBytesLoaded();
    perc = int((car/tot)*10)
    _xscale += (perc*10 - _xscale)/5
    if(car >= tot) _root.content.nextFrame();
    }

    //frame 2 --> graphics for studio

    '_root.content' is movie clip holder in my "main movie"

    Any suggestions ?

    cheers
    Last edited by Trippin13; 06-14-2004 at 11:07 PM.

  2. #2
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    I'm under the impression that your preloader might be displaying some figures, but isn't in fact preloading anything...
    Use another preloader!
    Don't like that code! But that's just my opinion!

    See if you can't get better results with this generic preloader...

    http://members.fortunecity.fr/fgill/genericpreload1.htm

  3. #3
    Senior Member
    Join Date
    Mar 2003
    Posts
    316

    no luck

    other preloader works fine for all root movies ... but rest .. I tried the one you gave me and couldn't even get it to work inside my movie ...I changed instance names and run the movie but my external movie or preloader wont show up at all ... I never thought getting a simple preloader would be that hard =)) I am not sure what is the problem ... the preloader is on the top layer I left the code the same just changed my empty movie to "containerMC" and put goto script on my menu button ... so theoretically it should work but I press the button and nothing happens ... I just didn't use level0 I used _root but it shouldn't make any difference ... ???

    Well I found one that seems to be working with my movie structure...
    but it still had to be inside the movie itself .. this becomes a problem If i want to use the code to load jpgs ...
    Last edited by Trippin13; 06-15-2004 at 02:16 AM.

  4. #4
    Member
    Join Date
    May 2002
    Location
    USA.me._x = 18; _y = 36;
    Posts
    79

    I have a similar problem...

    Trippin13--
    I'm having similar problems with my preloader display getting stuck on 100% and not fully loading the content to follow. With all due respect to Old Newbie's "generic preloader", I'm having a hard time adapting it to the Movie I'm working on. It's a shame too: I'm really trying to develope a modular preloader that can be reused in different contexts.

    did you say you found a new one that works for your needs?

    fp
    <fp>

  5. #5
    Junior Member
    Join Date
    Jun 2004
    Location
    Brooklyn, NY
    Posts
    10

    this one works for me

    // this goes on frame 2
    loadedbytes=getBytesLoaded();
    totalbytes=getBytesTotal();
    loadedkbytes=Math.ceil(loadedbytes/1024);
    totalkbytes=Math.ceil(totalbytes/1024);
    if (loadedbytes == totalbytes) {
    gotoAndPlay (4);
    }
    frame = int(loadedbytes/(totalbytes/100));
    loader_mc.gotoAndStop(frame);

    //then on frame 3 there is a 'gotoandplay' back to frame 1. so if the movie is loaded it will be directed to frame 4, past the preloader. Also you see the "frame" variable controls a percentage bar clip called 'loader_mc" to display how much is loaded.
    I've used this for nested swf's and it works fine for me.
    millsbury

  6. #6
    Senior Member
    Join Date
    Mar 2003
    Posts
    316

    code

    Here is the stuff that worked, real simple but somehow seemed ok in both cases with a bit of fiddling not sure why other ones didn't work =)) I gave up on the whole concept of _root.content and doing the levels as it seem to be inaccurate (I assume when using _root, _parent somehow loader waits for some other things to be loaded as well which makes it sit on 100%) so I tried "this." and seems to be preloading ok.

    //frame 1
    bytes_loaded = this.getBytesLoaded();
    bytes_total = this.getBytesTotal();
    getPercent = bytes_loaded/bytes_total*100;
    loadBar._xscale = getPercent;
    loadText = Math.round(getPercent)+"%";
    //frame 2
    if (getPercent < 100) {
    gotoAndPlay(1);
    }

    and then for dynamic pictures I used same code just "onClipEvent()"
    because I placed it on the actual empty image holder clip.

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