Adding a pre loader to an XML photo gallery between the photos.

Hey,
I have made a photogallery in actionscript 3 which uses an .XML file to import pictures. As the user clicks on the displayed image the code loads the next image in the cycle into the display. Now, I would like to add a preloader which displays the loading progress of each image as the user clicks (otherwise there is just a blank area as the image loads). I have made a pre-loader for the main .SWF but I can't figure out how to make it work for the images or how to make a seperate one for the images. The fact is that I am a bit of a muppet when it comes to AS3, and am finding myself getting lost an confused quite easily.
I have attatched the .FLA if that helps any! If not then...
here is the link to the .HTML page that contains the .swf:
http://www.davidframpton.co.uk/portfolio.html
Here is the code I am using for the main pre-loader held in frame 1:
stop();
addEventListener(Event.ENTER_FRAME, loaderF);
function loaderF(e:Event):void {
    var toLoad:Number = loaderInfo.bytesTotal;
    var loaded:Number = loaderInfo.bytesLoaded;
    var total:Number = loaded/toLoad;
    if(loaded == toLoad) {
        removeEventListener(Event.ENTER_FRAME, loaderF);
        gotoAndStop(2);
    } else {
        preloader_mc.preloaderFill_mc.scaleX = total;
        preloader_mc.percent_txt.text = Math.floor(total * 100) + "%";
And here is the code for the photogallery:
stop();
var xmlRequest:URLRequest = new URLRequest("http://www.davidframpton.co.uk/galleryData.xml");
var xmlLoader:URLLoader = new URLLoader (xmlRequest);
var imgData:XML;
var imageLoader:Loader;
var rawImage:String;
var rawH:String;
var rawW:String;
var imgNum:Number = 0;
var checkSec:Timer = new Timer(100);
var numberOfChildren:Number;
xmlLoader.addEventListener(Event.COMPLETE, xmlLoadedF);
master_mc.addEventListener(MouseEvent.CLICK, nextImgF);
master_mc.buttonMode = true;
function xmlLoadedF(event:Event):void{
    checkSec.start();
    checkSec.addEventListener(TimerEvent.TIMER, checkerF);
    imgData = new XML(event.target.data);
function packagedF():void{
    checkSec.removeEventListener(TimerEvent.TIMER, checkerF);
    rawImage = imgData.image[imgNum].imgURL;
    numberOfChildren = imgData.*.length();
    imageLoader = new Loader;
    imageLoader.load(new URLRequest(rawImage));
    master_mc.addChild(imageLoader);
function checkerF(event:TimerEvent):void{
    if (imgNum == 0) {
        packagedF();
    }else if(imgNum < numberOfChildren){
        imageLoader.unload();
        packagedF();
    }else {
        imageLoader.unload();
        imgNum = 0;
        packagedF();
function nextImgF(event:MouseEvent):void {
    checkSec.addEventListener(TimerEvent.TIMER, checkerF);
    imgNum++;
I would really appreciate any help. Even if your could guide me to where I can learn how to do this myself in an simple fashion, I would be greatful.
Thanks in advance
Dave

The Loader class has a contentLoaderInfo property that is a LoaderInfo class object.  You can assign an event listener to the contentLoader Info that listens for PROGRESS.  There is an example in the Loader class section that shows the contentLoaderInfo property being used for a variety of event detections, including PROGRESS.

Similar Messages

  • When I use the type tool or the selection tools, my photos blink between the photo and a black screen.  Anyone else have this issue?

    When I use the type tool or the selection tools, my photos blink between the photo and a black screen.  Anyone else have this issue?

    Does turning off »Use Graphics Processor« in the Performance Preferences and restarting Photoshop have any bearing on the issue?

  • Strange System Font in Dreamweaver.  After I installed Dreamweaver CS4 on my Mac, it loaded this strange font as seen in the photo attached.  Anyone know how to fix this?  I have uninstalled/reinstalled many times.  No prob w/ other CS4 programs.

    Strange System Font in Dreamweaver.  After I installed Dreamweaver CS4 on my Mac, it loaded this strange font as seen in the photo attached.  Anyone know how to fix this?  I have uninstalled/reinstalled many times to no avail.  There are no other problems with w/ other CS4 programs, they all have the normal system font.  I can't figure it out.  Thanks!

    Funny fonts issue in PI etc.,
    http://kb2.adobe.com/cps/405/kb405153.html
    Fonts in Dreamweaver panels display incorrectly
    http://kb2.adobe.com/cps/138/tn_13862.html
    Nadia
    Adobe Community Expert : Dreamweaver
    Unique CSS Templates | Tutorials | SEO Articles
    http://www.DreamweaverResources.com
    Web Design & Development
    http://www.perrelink.com.au
    http://twitter.com/nadiap

  • Printer won't load photo paper from the photo tray

    My HP C7280 won't load the 4x6 photo paper from the photo tray.  The photo tray moves in towards the feeder, but fails to actually load the paper into the feeder.  Any suggestions on how to correct it?  Thank you.
    Mike
    This question was solved.
    View Solution.

    Hey,
    Please take some time and look through this document to make sure that you are loading the paper properly,
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=c01662562&tmp_task=useCategory&cc=us&dlc=en&lc=e...
    These are the Macintosh instructions but the steps to prepare the photo print are the same but they are steps you would do on Windows just ignore the instructions.
    Have a great day. Get back to me.
    I worked for HP.

  • Creating a photo gallery like the China Gallery in Adobe Labs. How?

    I have photos in several categories (I'll use 2, "frank" and "wolfie" as examples here). What I'd like to do is build a photo gallery like the China Photo Gallery shown in the Adobe Labs site, where the user can switch between categories without going to a different page. Here's what I've done so far and how I'm stuck:
    I created a photo gallery with the instructions in the tutorial "Building a photo album with the Spry Framwork". I then inserted a Tabbed Panels widget for navigating between the categories.
    I set up an XML file as follows:
    /* frank category */
    <photo
    path = "001p.png"
    width = "467"
    height = "467"
    thumbpath = "001p.png"
    thumbwidth = "85"
    thumbheight = "85">
    </photo>
    /* wolfie category */
    <photo
    path = "001f.png"
    width = "467"
    height = "467"
    thumbpath = "001f.png"
    thumbwidth = "85"
    thumbheight = "85">
    </photo>
    To create the div holding the thumbnails for the "frank" category, I entered the following:
    <div class="thumbdiv" spry:region="dsGallery"><img src="thumbnails/frank/{@thumbpath}" spry:repeat="dsGallery" spry:setrow="dsGallery" class="thumbs" /></div>
    To create the div where the full size images will be displayed, I entered the following:
    <div class="mainpic" spry:detailregion="dsGallery"><img src="images/frank/{@path}" onload="MM_effectAppearFade(this, 1500, 0, 100, false)" /></div>
    Then, in the tabbed panel set for the "wolfie" category, I did the same thing, substituting "wolfie" for "frank". However, since there is only one xml file, spaceholders for all of the thumbnails appear in the thumbnail div for the frank category. I realize that I'll probably need to create a separate xml file for each category, but how do I set it up so the correct xml file is accessed when the link in the tab is clicked? Or am I approaching this all wrong?
    From reviewing the source for the China gallery, it appears that they set up links to different xml files instead of Tabbed Panels. How does that work? There are also some javascript files I can't find anywhere on Adobe's site.
    Thanks

    Hi,
    If you have seperate XML file but with the same basic structure then you can change the XML a Spry dataset refers to and regenerate the spry region without reloading the full page.
    So on my photo gallery page I can change the album the photos are shown from via the seturl sprydata function as below.  dsPhotos being my Spry dataset that points to the relevant XML dataset with my image references and captions etc.  My XML is actually dynamically generated from Picasa RSS feeds (and RSS feeds are XML) but the principle will be the same with your static XML.
    First I add an event listener for when someone clicks on an album (the li tag within my div with the id "albums" holds a photo and title for each album.)
    function Albums()
    var myalbums = Spry.$$("#albums li", "TabbedPanels1")
    var rows = dsAlbums.getData();
    var setListener = function( element, value )
      Spry.Utils.addEventListener( element, "click", function(){ showAlbum( value ); },false );
    for( var i = 0, length = myalbums.length; i < length; i++ )
      setListener( myalbums[i], i );
    Then this is the code which changes the photo album to be shown. (when the user clicks the relevant album)
    function showAlbum(i)
    pauseShow();
    pImage = 'No';
    var rows = dsAlbums.getData();
    var albumid = rows[i]["albumid"];
    var url = "xml/PicasaAphotoFeed.asp?albumid=" + albumid;
    dsPhotos.setURL(url);
    dsPhotos.loadData();
    var rowcount = dsAlbums.getRowCount() - 1;
    var nextalbum;
    var navnext;
    var n;
    The page is here www.thehmc.co.uk/photo5.html is you want to see it in context.
    In your case showAlbum would switch between Frank.xml or Wolfie.xml depending on how you decide to name your xml datasets.
    Regards
    Phil

  • I am facing a strange problem on new iphone 5 that I bought last week. The maps app and the places in photo gallery shows the pin and my location, however there is no information of locations. Tried to close the apps, phone restart, reset etc. Please help

    I am facing a strange problem on new iphone 5 that I bought last week. The maps app and the places in photo gallery shows the pin and my location, however there is no information of locations. Tried to close the apps, phone restart, reset etc. I am accessing it via strong wireless connection and it works fine on other devices. Please help.

    zapgrap wrote:
    there is no information of locations.
    Then no information exists.  Use the Report a Problem button within the app to report it.

  • Adobe muse - how to upload images in photo gallery in the admin console?

    Question from Adobe Muse beginner - I can't figure out how images can be uploaded in a slideshow/photo gallery in the admin console? I can edit or delete images but not upload additional images?

    Hi,
    May I know which admin console are you talking about.
    You are talking about Business Catalyst or Adobe Muse?
    Please provide the steps to access the admin console via Muse.
    Regards,
    Gaurav Aggarwal

  • I have deleted the last imported photos thinking that the photos were kept in the album, but all my photos are now gone. How can I get the photos back from trash ?

    I have deleted my file "last imported photos" thinking that the photos were kept in the album, but now all my photos are gone; How can I recover the deleted photos?
    M

    If you have emmptied the iPhoto trash then you're going to need a file recovery application like File Salvage

  • Before when I scanned a photo, it would automatically save and ask to scan another photo. Now, the photo is not saving and it doesn't ask to scan again. Help?

    Before when I scanned a photo, it would automatically save and ask to scan another photo. Now, the photo is not saving and it doesn't ask to scan again. Help?

    What Scanner and scanware are you using....?
    Check out > Mac Basics: Using a scanner
    I only use Image Capture and it always sends my photos to wherever I tell it to.

  • Since I synced my ipad to my iMac I have duplicate photos appearing in the Photo section on my iPad and one can be trashed but the other one can't. How can I get rid of the ones without the trashcan?

    Since I synced my ipad to my iMac I have duplicate photos appearing in the Photo section on my iPad and one can be trashed but the other one can't. How can I get rid of the ones without the trashcan?

    Thanks so much. I was afraid to mess with that.  But when I unsynced them, it worked.

  • I have iCloud set up fine on Windows 8 and it pulls shared photo streaming great, The problem is that in My Photo Stream folder the photos doesn't charge automatically and is empty, how can I do?

    I have iCloud set up fine on Windows 8 and it pulls shared photo streaming great, The problem is that in My Photo Stream folder the photos doesn't charge automatically and is empty, how can I do?

    Hey appleIC!
    Here is an article that will help you troubleshoot this issue:
    iCloud: My Photo Stream troubleshooting
    http://support.apple.com/kb/ts3989
    Take care, and thanks for visiting the Apple Support Communities.
    Cheers,
    Braden

  • When in Adobe Bridge and trying to create a web photo gallery, under the windows menu and then the workspace menu there is no output option.  Where is it?

    When in Adobe Bridge and trying to create a web photo gallery, under the windows menu and then the workspace menu there is no output option.  Where is it?

    You haven't provided any sensible, meaningful and detailed information about your setup.
    If you gave some sensible, complete and detailed information, someone may be able to help you, such as your platform (Mac or Win), exact versions of your OS, of Photoshop and of Bridge, machine specs, what troubleshooting steps you have taken so far, etc.
    There are no clairvoyants or mind readers here.
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • Get employee photo and display the photo in external system.

    Hi,
    We start to work with the portal....We want an application that display the employee photo..
    The photo is the same one that appear in pa20/30...
    We create the photos in OAAD and have a table repository.
    How from here i can use this to build a RFC that return "data"..that from the external system we can show the photo,
    Thanks.

    write a RFC which uses
    'HR_IMAGE_EXISTS' to get the image document id and then use 'ALINK_RFC_TABLE_GET' to  image in JPG format convert the returned RAW table to xstring format using SCMS_BINARY_TO_XSTRING pass the resulting xstring as the export parameter of this RFC .
    portal application can now use this xsring to render the image.
    Regards
    Raja

  • How can I add a photo to a newly created photo book it the photo wasn't in the album I made the book from? thnx

    how can I add a photo to a newly created photo book it the photo wasn't in the album I made the book from? thnx

    Drag it to the book project in the source pane on the left
    LN

  • HT4623 I just updated my iphone 4s and lost all my photos except in the photo stream.

    I just updated my iphone, but lost all my photos except in the photo stream.... I did back it up before i updated.  Anyone know where they could be?

    /Are you using itunes or icloud backup?  http://support.apple.com/kb/HT1766

Maybe you are looking for