Results 1 to 10 of 10

Thread: Simple flash photo fader

  1. #1
    Join Date
    Oct 2008
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Simple flash photo fader

    I'm very new to flash, but I'd like to make a photo fader/slide show like the one here: http://jmshots.com/main.html
    Just a simple program that cross-fades through lets say, five photos, and then starts over. It would be really awesome if the flash program loaded the images from an external folder (like /images), so I could change the pictures without having to change the actual flash file.
    I tried and tried to make sense of this: http://www.dynamicdrive.com/forums/s...ad.php?t=21364 but couldn't get it to work...
    Is this an easy task? Any help would be greatly appreciated.

    Thank you
    Austin

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Hi Austin...

    I'm walking GordonBennet through a similar application over in this thread. I encourage you to follow along.

    It's not 100% what you're asking for. But it's 95% there. The rest, I'll be happy to advise you on.

    Edit: You should probably post your questions/comments in this thread. Otherwise, it'll get too confusing for anyone to follow (especially me ).

  3. #3
    Join Date
    Oct 2008
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you, I'll read up on it and ask questions here.
    Thank you!

  4. #4
    Join Date
    Oct 2008
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    So if I am correct, for me I'd want to forget about putting the <left>,<right>,<center> tags. I would write a xml file like this:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <gallery>
    	<page>/image01.jpg</page>
    	<page>/image02.jpg</page>
    	<page>/image03.jpg</page>
            .....
    <gallery>

  5. #5
    Join Date
    Oct 2008
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I am lost as to what I should do here:

    could I just skip this step?

  6. #6
    Join Date
    Oct 2008
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    So far, here is what I have with changes highlighted:
    Code:
    // Initiate XML
    var xml:XML = new XML();
    xml.ignoreWhite = true;
    
    // Variables
    var total:Number = new Number();
    var path:String = new String();
    var positions:Array = new Array(left, center, right); //not sure if this is needed
    var current:Number = 0;
    
    // Load XML 
    xml.onLoad = function(success) {
    	if(success) {
    		total = xml.firstChild.childNodes.length // Set total number of pages
    		path = xml.firstChild.attributes.path;
    		loadImages(current);
    	}
    	else {
    		trace("Error: XML Didn't Load");
    	}
    }
    
    // Load Images
    function loadImages(page) {
    	pageNo.text = "PAGE " + (page+1) + " OF " + total;
    	for(i=0;i<3;i++) {
    		var imagePath:String = path + xml.firstChild.childNodes[page].childNodes[i].childNodes
    		if(imagePath!="") {
    			positions[i].loadMovie(imagePath);
    		}
    	}
    	createNavigation();
    }
    
    // Next Function
    next.setInterval(current, 5000) = goForward; //after 5 seconds go to next image
    function goForward() {
    	current++;
    	loadImages(current);
    }
    xml.load("gallary.xml");

  7. #7
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Quote Originally Posted by Austinkir View Post
    So if I am correct, for me I'd want to forget about putting the <left>,<right>,<center> tags. I would write a xml file like this:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <gallery>
    	<page>/image01.jpg</page>
    	<page>/image02.jpg</page>
    	<page>/image03.jpg</page>
            .....
    <gallery>
    Yup. That'll work.

    Quote Originally Posted by Austinkir View Post
    I am lost as to what I should do here:

    could I just skip this step?
    Yes, since you'll only be targeting one movieclip, there is no need for an array. Wherever you see positions[n], you can replace it with the name of your container movieclip.

    Quote Originally Posted by Austinkir View Post
    So far, here is what I have with changes highlighted:
    Code:
    // Initiate XML
    var xml:XML = new XML();
    xml.ignoreWhite = true;
    
    // Variables
    var total:Number = new Number();
    var path:String = new String();
    var positions:Array = new Array(left, center, right); //not sure if this is needed
    var current:Number = 0;
    
    // Load XML 
    xml.onLoad = function(success) {
    	if(success) {
    		total = xml.firstChild.childNodes.length // Set total number of pages
    		path = xml.firstChild.attributes.path;
    		loadImages(current);
    	}
    	else {
    		trace("Error: XML Didn't Load");
    	}
    }
    
    // Load Images
    function loadImages(page) {
    	pageNo.text = "PAGE " + (page+1) + " OF " + total;
    	for(i=0;i<3;i++) {
    		var imagePath:String = path + xml.firstChild.childNodes[page].childNodes[i].childNodes
    		if(imagePath!="") {
    			positions[i].loadMovie(imagePath);
    		}
    	}
    	createNavigation();
    }
    
    // Next Function
    next.setInterval(current, 5000) = goForward; //after 5 seconds go to next image
    function goForward() {
    	current++;
    	loadImages(current);
    }
    xml.load("gallary.xml");
    Looks good so far. Change the positions[x] as mentioned above. You also don't seem to be including a path attribute in your XML file. If you don't plan to do so, you can remove references to the variable path.

    You should delete significant portions of the for loop in the loadImages() function as you'll only have one image on the stage at a time. The text in red can be deleted.
    Code:
    function loadImages(page) {
    	pageNo.text = "PAGE " + (page+1) + " OF " + total;
    	for(i=0;i<3;i++) {
    		var imagePath:String = path + xml.firstChild.childNodes[page].childNodes[i].childNodes
    		if(imagePath!="") {
    			positions[i].loadMovie(imagePath);
    		}
    	}
    	createNavigation();
    }

  8. #8
    Join Date
    Oct 2008
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    The last two days have been very busy and I haven't been able to get on.
    Thanks for your help!

    After trying to test the movie, I get the following error:
    Code:
    Left side of assignment operator must be variable or property.
    with this listed as the source:
    Code:
    next.setInterval(current, 5000) = goForward; //after 5 seconds go to next image
    Did I phrase the setInterval code wrong?

    Here is my complete current actionscript(2):
    Code:
    // Initiate XML
    var xml:XML = new XML();
    xml.ignoreWhite = true;
    
    // Variables
    var total:Number = new Number();
    var path:String = new String();
    var current:Number = 0;
    
    // Load XML 
    xml.onLoad = function(success) {
    	if(success) {
    		total = xml.firstChild.childNodes.length // Set total number of pages
    		path = xml.firstChild.attributes.path;
    		loadImages(current);
    	}
    	else {
    		trace("Error: XML Didn't Load");
    	}
    }
    
    // Load Images
    function loadImages(page) {
    	pageNo.text = "PAGE " + (page+1) + " OF " + total;
    		var imagePath:String = xml.firstChild.childNodes[page].childNodes[i].childNodes
    			positions[i].loadMovie(imagePath);
    	createNavigation();
    }
    
    // Next Function
    next.setInterval(current, 5000) = goForward; //after 5 seconds go to next image
    function goForward() {
    	current++;
    	loadImages(current);
    }
    xml.load("gallary.xml");

  9. #9
    Join Date
    Sep 2008
    Location
    Strawberry Hill, Twickenham, London, UK.
    Posts
    15
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Great Tutorial!

    Here is a great tutorial for a slide show it is very easy to create and use, it can be made in less than 20mins.

    http://www.kirupa.com/developer/mx/photogallery.htm

    I hope this helps.

  10. #10
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Did I phrase the setInterval code wrong?
    Yeah, it should be:
    Code:
    setInterval(goForward, 5000)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •