A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Preloading JPG's into _child._child._child....

  1. #1
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113

    Preloading JPG's into _child._child._child....

    I have searched with no luck

    In my movie, I have the main timeline, a empty mc called "empty". Into empty, I am loading the various sections- contact, portfolio, gallery, etc.

    Inside the 'gallery' external load, i have another mc "p_empty". Into 'p_empty' I am loading images. I am looking for a way to make a, preferably, percentage preloader for the images loaded into the 'p_empty'. I have screwed myself over with pathing, so could someone give me a hand?

    Thanks a lot!

    Steve
    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

  2. #2
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Have you gotten the loading of a picture to work?
    If so, and loading it from the main movie, what path did you use?

    Seems to me it would be something like...

    loadMovie("your.jpg", "_root.empty.p_empty");

    If so, how about...

    _root.empty.p_empty.getBytesLoaded()

  3. #3
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113
    Alright, so I need to be controlling it from the absolute _root, _level0? If so, it's a basic preloader code, yes? So far, I have found somethin like this:
    Code:
    stop();
    p_empty.onEnterFrame = function() {
    	L = p_empty.getBytesLoaded()/1024;
    	T = p_empty.getBytesTotal()/1024;
    	P = L/T*100;
    	loaded.text = Math.round(P);
    	if (P == 100) {
    		loaded._visible = 0;
    		delete this.onEnterFrame;
    	}
    };
    But it doesn't work. No text in the box, no nothin. The paths for the images being loaded are correct, meaning they load offline. Online is another story

    This is the code:
    Code:
    on(release){
    	_parent._parent.p_empty.loadMovie("horizontalImages/"+_parent._name+".jpg")
    }
    To get the images to load. I have fading movieclips, somethin like a lightbox if you will, and inside those is another MC, where the MC with this code lies. (I have a "onClipEvent(load){ onRelease() } so that it can use on() events).

    The "_parent._name" is the name of the, well, parent MC. These are named as the images they are covering, and hence, supposed to load.

    I hope I made sense, and I appreciate your reply, oldnewbie.

    -Steve
    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

  4. #4
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Can you attach your .flas - the main one and the one of the .swf that gets loaded in "empty", holding "p_empty"... - zipped up and in MX only format? Or you can e-mail them to me, if you prefer not to publicly post them. PM me and I'll provide an address, if you want to go the e-mail route.

  5. #5
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749
    This is a useful little function:
    code:

    function is_loaded(mc, showpercent) {
    var temp;
    temp = mc.getBytesTotal();
    temp = temp>0 ? mc.getBytesLoaded()/temp : 1;
    return showpercent == true ? temp : temp == 1;
    }


    You would use it by using the target MC as the mc argument. If you set the showpercent argument as true, it will return the proportion of the file that is loaded, otherwise it just returns true or false.
    You can use it in onEnterFrame for a loadMovie.

  6. #6
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113
    I'll try it coffey.

    old- I cannot post the fla's...wouldn't be much help. I guess the main question is where I need to put preloader code, and how. I assume it would be easiest to do it from the gallry swf, where the images are loaded into via loadMovie(). It's a bit hard to explain, I know, but the concept is easy.

    A few questions I have about these preloaders. The majority of them are onClipEvent(enterFrame) directly on the MC where external movies are loaded in, right? But the only time I have used preloaders are in the first frame, using the onClipEvent. Then they are gone after frame one...

    I see this as a CPU consumption problem because the MC is on the same frame that the movie stops at, so the container MC would be preloading nothing, see what I mean? Maybe you could see what I am after if you go to the site in my footer. There is a slight pause between the loading process, so that gap is the externals being loaded. I will make a mock .fla tonite for a bit better understanding.

    Thanks

    -Steve
    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

  7. #7
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Ever had a look at my generic preloader?

    http://www.flashkit.com/board/showth...hreadid=456020

    That one can preload from the main movie, any other external movie in container clips, on any other levels, in container clips nested in external movies themselves loaded in container clips or other levels of the main movie, or what have you. It's all in the correct pathing of what you want to preload. It uses an onEnterFrame function, but which is deleted, when the preloading's done.
    You use your loadMovie action, then call upon the preloader to take it from there until the preloading is done.

  8. #8
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113
    I shall download it at home. Thanks!
    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

  9. #9
    free-webmaster-resource.com deamothul's Avatar
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    1,475
    Originally posted by oldnewbie
    Ever had a look at my generic preloader?
    i love that preloader of yours Oldnewbie, its really great.
    i use it all the time now

  10. #10
    RIDER
    Join Date
    Aug 2000
    Location
    Munich-Sydney
    Posts
    177
    You use your loadMovie action, then call upon the preloader to take it from there until the preloading is done.
    How would I callup the preloader ??
    I know its a stupid question.
    take it or leave it


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