A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [RESOLVED] Making a slideshow, doesn't work if I test it in a browser

  1. #1
    Member
    Join Date
    May 2008
    Location
    Ohio, USA
    Posts
    63

    resolved [RESOLVED] Making a slideshow, doesn't work if I test it in a browser

    I'm working on a slideshow using a class that I wrote that builds the slideshow and an XML file that points to the images. I plan on improving it later but for now I just want it to cycle through a set of images, resize them if they're too big or small, and show a loading bar while the image is loading. It works fine if I test it in the Flash IDE or standalone Flash Player, but if I drag the SWF into Firefox or Safari, the loading bar refuses to show up. I also tried publishing to an HTML file and that didn't work either. I figured there could only be two different reasons why it wasn't showing up - either it wasn't being added to the stage, it wasn't being made visible after it's initially set to invisible. I decided to comment out the part of the code that make it invisible to begin with the loading bar showed up, but it wasn't showing how much of the image had been loaded when it changed to a new picture. Here's my code:
    PHP Code:
    //load a new picture
    private function loadNewPicture():void {
        
    //reset the picture index when we run out of pictures
        
    if (picIndex == numPics) {
            
    picIndex 0;
        }
        
    //create a loader for the new picture
        
    picLoader = new Loader();
        
    //load the picture
        
    picLoader.load(new URLRequest(pictureXML.pictures.path[picIndex].toString()));
        
    picLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESSpictureLoading);
        
    picLoader.contentLoaderInfo.addEventListener(Event.COMPLETEpictureLoaded);
        
    numPics pictureXML.pictures.path.length();
    }
    //show the loading bar while the next picture is loading
    private function pictureLoading(e:ProgressEvent):void {
        if (
    getTimer() - currentTime 250) {
            
    loadingBarFG.scaleX e.bytesLoaded/e.bytesTotal;
            
    loadingBar.visible true;
        }

    For some reason the pictureLoading function isn't being called when I test it in any browser. I've seen the loading bar randomly pop up a few in times in Safari 4 but then I try closing the window and testing it again and I get nothing. Can anyone help me figure this out? About:plugins in Firefox says I have Flash Player 10.0.22 installed, and I'm using Flash CS3 in OS X.
    Last edited by DoomOfTheLiving; 08-02-2009 at 03:15 AM.

  2. #2
    lemon juice hurts your eyes florianvanthuyn's Avatar
    Join Date
    Jul 2005
    Location
    Merelbeke, Belgium
    Posts
    546
    Does the image that is supposed to be loaded show up? Because when testing locally (even in the browser) the loading happens almost instantly and a preloader usually doesn't have the time to show up and show the progress.
    Also, the Flash Player caches things it loads in, so while a preloader might pop up for a brief moment the first time you test it (and after the cache has been cleared), it probably will stop doing that the second, 3rd, etc time
    Florian Vanthuyne

    WAR AGAINST SOLVED THREADS
    mark yours as Resolved under Thread Tools!

  3. #3
    Member
    Join Date
    May 2008
    Location
    Ohio, USA
    Posts
    63
    The first 4 images referenced in the XML file are on my hard drive, which I'm accessing through an Apache server. The rest are being downloaded from various websites. It turns out you were right about the images being cached, though - I opened up Chromium, found a very large image on Google Images, and added the URL to my XML file. Then I published my Flash project and tested it in Firefox again, and this time the loading bar came up for the new image I added. Thanks for clearing that up for me.

  4. #4
    lemon juice hurts your eyes florianvanthuyn's Avatar
    Join Date
    Jul 2005
    Location
    Merelbeke, Belgium
    Posts
    546
    No problem! These are things I've encountered numerous times, and when I'm not paying attention I spend a lot of time trying to solve those things, even though the solution is actually doing nothing or almost nothing
    Florian Vanthuyne

    WAR AGAINST SOLVED THREADS
    mark yours as Resolved under Thread Tools!

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