A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Load next JPEG

  1. #1
    Senior Member
    Join Date
    Oct 2007
    Posts
    120

    Load next JPEG

    Hello,
    I'm am trying to load images from a folder into a swf. When the next button is clicked I want the next JPEG in the folder to be loaded. Something like when button "Next" is clicked, load "imagesfolder/" +NextImage+".jpg"

    Does anyone know of a good tutorial or solution?

    For an example: http://www.webwasp.co.uk/tutorials/b...4/tutorial.php
    Tried to do this, but couldn't get it to work right...

  2. #2
    Senior Member
    Join Date
    Nov 2005
    Location
    dante's inferno
    Posts
    904
    simplified:

    PHP Code:
    var arMyImages = new Array('dog.jpg','cat.jpg','bird.jpg','mouse.jpg','monkey.jpg');

    var 
    iShowImage  0;
    var 
    iTotalImage arMyImages.length 1;



    nextImage_btn.onRelease = function(){
        
    trace('show image:' +  iShowImage ' - Total image: '+iTotalImage);
        if(
    iShowImage iTotalImage){
            
    loadMovie('imagesfolder/'arMyImages[iShowImage], "photo_mc");
            
    trace('what image: '+arMyImages[iShowImage]);
            
    iShowImage++;
        }else{
            
    loadMovie('imagesfolder/'arMyImages[iShowImage], "photo_mc");
            
    trace('what image: '+arMyImages[iShowImage]);
            
    iShowImage 0;
        }    

    hope this gets you started in the right direction

    IMS

  3. #3
    Senior Member
    Join Date
    Oct 2007
    Posts
    120
    Thanks, that worked perfectly! Also, I've been trying to get image loader to work?
    Like on click preload JPEG?

    I'm using this:
    PHP Code:
    mybutton.onRelease = function() {
        
    infoField._visible true;
        
    startLoading("imagefolder/image01.jpg");
    };




    function 
    startLoading(whichImage) {
        
    loadMovie(whichImage"imageLoader");
        
    _root.onEnterFrame = function() {
            
    infoLoaded imageLoader.getBytesLoaded();
            
    infoTotal imageLoader.getBytesTotal();
            
    percentage Math.floor(infoLoaded/infoTotal*100);
            
    infoField.text percentage+"%";
            if (
    percentage>=100) {
                
    delete this.onEnterFrame;
                
    infoField._visible false;
            }
        };

    But doesn't seem to be working either...

  4. #4
    Senior Member
    Join Date
    Oct 2007
    Posts
    120
    Is there a way to have a JPEG load on top of another JPEG? So while image02.jpg is being loaded, image01.jpg remains on the screen until image02.jpg is done.

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