dcsimg
A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: loading JPEG into movieclip question

  1. #1
    Senior Member
    Join Date
    Feb 2002
    Location
    UK
    Posts
    436

    loading JPEG into movieclip question

    Hi

    im loading a whole load of JPEGs into seperate movieclips BUT im now unable to include any 'loading' devices as they're not included within SWF files

    does anybody know how I can do this?

    thanks alot for your help

  2. #2
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    If you want to preload the images, you can have a preloader in the main timeline that targets the movieclips you are loading the jpg's into.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  3. #3
    Senior Member
    Join Date
    Feb 2002
    Location
    UK
    Posts
    436
    mmmmm..... these images will be loaded one at a time once everything else has been loaded - kind of like a gallery - so I dont want to load them all at the beginning, but one by one.

    The crude way to do it is to put the word 'loading' underneath the area its being loaded into - but this wont let me have a loading bar or anything.

  4. #4
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    You can put a preloader anywhere in the movie, and preloading just specific things as jpg's loading in a empty movieclip. I use it all the time even to preload 5kb images or swf's.
    Its just a matter of targeting the empty mc instead of the _root as you do with preloaders for the whole movie.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  5. #5
    Senior Member
    Join Date
    Feb 2002
    Location
    UK
    Posts
    436
    mmmmm.... but if I do a getbytesloaded on an empty movieclip it will think its loaded before the jpeg has loaded wont it?!

    Im confused

    I might just put the jpeg into its own SWf and load that instead

  6. #6
    Senior Member
    Join Date
    Feb 2002
    Location
    UK
    Posts
    436
    what im trying to say is - the jpegs getting loaded directly into the swf and so there isnt any way of knowing how much of it has loaded is there?

    if it was already sitting at the end of a swf you could tell how much of the total has been loaded

  7. #7
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    I dont know how you are loading the jpg's, normally you load jpgs into target movieclips. If thats the case you have an if statement that makes shure some bytes are loaded before checking. That way it wont try to figure out a empty MC.
    Heres the code I use ( I have it on a MC, with a percent textfield in it ).

    (jpgMC being the name of the movieclip where a jpg is loaded into).

    onClipEvent (enterFrame) {
    // PRELOADER PART
    tb = math.round(_root.jpgMC.getBytesTotal()/1024);
    lb = math.round(_root.jpgMC.getBytesLoaded()/1024);
    percent = math.round((lb/tb)*100);
    if (lb>5) {
    if (percent == 100) {
    _root.movies.play();
    }
    }

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  8. #8
    Senior Member
    Join Date
    Feb 2002
    Location
    UK
    Posts
    436
    oooook cheers - ill give it a try - Im guessing i put this code on the mc the jpegs being loaded into

  9. #9
    Senior Member
    Join Date
    Feb 2002
    Location
    UK
    Posts
    436
    its not working for me

    im loading my jpeg like follows:

    loadMovie("image2.jpg", "image");

    and then putting your code onto the MC 'image' with a textfield on the main stage called percentage - but no percentage shows up

    never mind - ill stick to my basic way for thetime being

    thanks anyway

  10. #10
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Here is a slide show where the next pic is loaded while you look at one pic but not all of them. Check the scripts also inside the empty movieclips.
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  11. #11
    Senior Member
    Join Date
    Feb 2002
    Location
    UK
    Posts
    436
    woh! - that's a little bit over my head (some of it)

    so your preloading ALL the images at the start before you go on?

    i really need them to load individually so you can see each one as it loads.

    I might put this on the back burner for the time being - but thanks for all your help

    I'll try and figure out your file later on

    thanks again

  12. #12
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    No. Look at this code:

    function loadImage(img,nextImg,viewNext,viewPrev){
    clipLoader_1.loadMovie(viewNext);
    clipLoader_2.loadMovie(viewPrev)
    bilder_1.loadMovie(img);
    bilder_2.loadMovie(nextImg);
    bilder_2._alpha = 0;
    }

    in bilder_1 you load your pic which you want to see. In bilder_2 which is invisible you preload your next pic but you load only one at a time. Just use frames to show your pics. I know people like to make slideshows with one frame but sometimes that is not convenient.
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  13. #13
    Senior Member
    Join Date
    Feb 2002
    Location
    UK
    Posts
    436
    mmmm... its becoming a little clearer. Basically - what ive got is a movieclip - in this movieclip is another 6 empty movieclips which 6 jpegs get loaded into (all at once).

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