Flash image gallery example (Actionscript 2) – using PHP to list images from folder

this is simple gallery example for AS2
gallery is nothing special, ease to use and implement

interesting thing about this example is that you pass a folder, and PHP side gathers image list from a folder and returns it to the Flash in XML form together with images widths and height which makes it more easier to implement this sort of galleries like I’ve made

so from this example you can see :

  • PHP serving XML to Flash
  • PHP getting image size (width and height)
  • Flash loading XML
  • Flash creating elements on stage using library
  • loading external images
  • and more…

this example is for beginner level

example : http://www.hagane.us/as/gallery/
ZIP : http://www.hagane.us/as/gallery/gallery.zip

if you have any questions about PHP or Flash side please post it here

EDIT: sorry for wrong links and config. Everything is corrected now and fully functional
thanks people who noted me about errors!

About these ads

57 Responses to “Flash image gallery example (Actionscript 2) – using PHP to list images from folder”


  1. 1 Beedigital January 8, 2008 at 9:38 pm

    The links for the example & source are not working….

  2. 2 simply_accessible January 8, 2008 at 10:44 pm

    Does such a thing exist? both example and ZIP are broken-links.

  3. 3 Oleg January 8, 2008 at 11:28 pm

    Check the links in your example – it’s pointed to localhost ;)

  4. 5 David Sikma January 9, 2008 at 6:37 am

    Wow thanks! I’ve been displaying my images in a very similar way but this is a much easier to build and maintain a site. What would the be the simplest way to ad a link to the top of the page? Link on top of my current site.

  5. 6 Beebs January 10, 2008 at 6:21 am

    MrSteel,

    I really like this gallery. Unfortunately my server does not have PHP. Can you please help me to provide the XML version only? Can you please give me ahint for the xml file structure for the start?

    Thanks a lot

  6. 7 mrsteel January 10, 2008 at 2:32 pm

    Yes, You can create XML by yourself
    and pass xmlPath parameter through flashvars in index.html (as I pass php location)

    structure of XML you can see at
    http://www.hagane.us/as/gallery/PHP/getimages.php

  7. 8 mrsteel January 10, 2008 at 2:36 pm

    @David and all :

    yes you’re site could definitly use this gallery
    you can add anything you want into the FLA file (logos, contant links …) and recompile it and use it on your site

  8. 9 Beebs January 10, 2008 at 9:36 pm

    Thanks a lot for repply Mr.Steel. I really appreciate it.
    I have further question/request :

    With the XML version, How possible to check the width and the height through Actionscript dynamically – so that the width and height property does not need to be listed in the XML file?

    Thanks again.

  9. 10 mrsteel January 11, 2008 at 2:38 am

    it’s not possible with AS2 version
    that’s why PHP jumps in
    AS2 only knows image size when it’s loaded

  10. 12 srinivas January 28, 2008 at 10:08 pm

    Thanks for good stuf with php..

    I want one help I have flash file that reads data from php and builts a link .
    by clicking this link can we get flash pop up window?? pls help ??

  11. 13 mrsteel January 29, 2008 at 9:19 pm

    please
    send me description of your problem, together with sources to my email at yahoo
    putrefactive [at] yahoo [dot] com

  12. 15 srinivas January 31, 2008 at 2:08 pm

    thanks for responce

  13. 16 kathir March 7, 2008 at 5:28 am

    i want to print a special char in flash through php ?
    how can i do it?

  14. 17 colin May 30, 2008 at 2:38 am

    the source file is not workable

  15. 18 mrsteel May 30, 2008 at 2:46 am

    you need flash cs3 anyway I will send you flash 8 version

  16. 19 Simon B June 23, 2008 at 11:03 am

    Thanks for a Flash gallery simple enough for me to understand and alter bits. Going acrzy looking for where to alter the size and colour of the borders around the images though… Can you point me to the right bit? cheers

  17. 20 virtuoosi July 28, 2008 at 4:53 am

    thanks, its simple and just what i was looking for

  18. 21 Bing August 16, 2008 at 12:12 pm

    I have implemented your flash on my site. Just wonder what other options that I can use. I am looking for options to load the image, starting from the left instead of the center. Also, want to see if there is an option to show file name. Thx

  19. 22 mrsteel August 29, 2008 at 10:31 am

    I will probably do another gallery with few other options but built in AS3…

  20. 23 Dwaine January 6, 2009 at 8:29 am

    hello,

    i need to have different folders for different galleries, ie, not all images will be in the images folder?
    Where should I change the images folder variable, cant seem to change it correctly! :(
    Please help!

  21. 24 saugat January 13, 2009 at 10:07 pm

    I want to build up a xml base photo gallery.
    I want some help.
    I have a sample i want to make some change on it

  22. 25 kzorg February 19, 2009 at 2:04 am

    The source .fla has graphics for next and previous buttons included. Is there a way to enable them?

  23. 26 keyon March 26, 2009 at 4:53 pm

    I need so help i have this code it works a little,
    the only problem with it is that when i try to place the code and images in a MClip to place it on the Stage. it does not work please help

    all i need is a good working image scroll gallery for AS2 with no xml

    panel.onRollOver = panelOver;

    function panelOver() {
    this.onEnterFrame = scrollPanel;
    delete this.onRollOver;
    }

    var b = stroke.getBounds(_root);

    function scrollPanel() {
    if(_xmouseb.xMax || _ymouseb.yMax) {
    this.onRollOver = panelOver;
    delete this.onEnterFrame;
    }

    if(panel._x >= 89) {
    panel._x = 89;
    }

    if(panel._x <= -751) {
    panel._x = -751;
    }

    var xdist = _xmouse – 400;

    panel._x += Math.round(-xdist / 7);
    }

  24. 27 Brick May 16, 2009 at 8:08 pm

    Nice article, Thanks for sharing

  25. 28 Felipe June 16, 2009 at 2:01 am

    Please, help me.

    How I can change the width/height of the image?

    I need to do this in a site, but I don’t know AS very well.

    If someone explains to me, shows an example too.

    Thank you a lot!

  26. 29 mrsteel June 16, 2009 at 3:22 pm

    change width /height of which image?

    this gallery automatically takes width and height of image in folder and bring it through XML to Flash …

  27. 30 Reiki July 1, 2009 at 5:18 pm

    Excellent information. Finding a few such solutions has taken hours in the past.

    Thank u.

  28. 31 Philip August 7, 2009 at 2:28 am

    Mr Steel, this is awesome! I just have one problem; When i place this inside a movieclip TempMC seem to get the right width and height but it does not load the images. Do you have a solution to this? I would realy appreciate it!

  29. 33 excel help August 28, 2009 at 5:50 pm

    This is really beautiful. Inspiration by the design literally!

  30. 34 jsoh December 8, 2009 at 6:38 pm

    Great bit of flash!

    Is there away to get the php to order the images by name not date?

    Also is there an engligh version of the class.get.files?

    Thanks

  31. 35 Rajib Datta January 29, 2010 at 5:19 pm

    when i wanted to run gallery .fla file,the value of xml.firstChild.childNodes.length becomes undefined.could you tell me why?

  32. 36 TiLou April 22, 2010 at 8:59 am

    Hi Mr. Steel, I want to say thank you for this turtorial. I would like to use it, but it’s not working for me. “THE IMAGES ARE NOT SHOWING UP” I was reading some up there about the comments from :

    ” Oleg // January 8, 2008 at 11:28 pm | Reply

    “Check the links in your example – it’s pointed to localhost ”

    Does it have something to do with my file path? I have the folder on my desktop. Please let me know,I would like to use this galerry.

    Thanks in advance

  33. 37 lara_macu June 2, 2010 at 7:03 am

    Hello mr.steel!
    Thanks for the post, it’s just what I’m looking for to this school project I’m doing. (one part being an autoupdating image bank)
    But, I have the same problem as TiLou, I can’t see the images…
    I have to say I have no experience with php, so do you have to upload the php file to a server or something?

    br
    LaraMacu

  34. 38 Ron July 24, 2010 at 12:07 am

    Hi, this is AMAZING!
    I have it working fine although the images overlap. They all vary in size but aren’t very big. What is the deal with numbering the image files? Is there a proper way to do it?

  35. 39 Ron July 24, 2010 at 12:58 am

    I figured out the overlap.

    Just don’t understand the file numbering and how to get the images in a prefered order.

  36. 40 MrSteel July 24, 2010 at 1:11 am

    you would need to do sorting of files either inside of flash, or in PHP file getimages.php
    or you can submit different xml in flashvars, some XML that you wrote containg same nodes as http://www.hagane.us/as/gallery/PHP/getimages.php

  37. 41 Ron July 24, 2010 at 3:21 am

    Excellent! Thankyou.

    Also, is it hard to add a button that returns it back to the first image? I have alot of images and its tedious clicking back through

  38. 42 Ron July 24, 2010 at 3:55 am

    I’m really struggling with the order. I have little PHP knowledge, could you make it simpler? If thats possible!

  39. 43 suraj October 10, 2010 at 4:39 pm

    source file is not running for me after rendering swf
    output panel shows number like ’300′ but on stage nothing

  40. 44 raj malik March 4, 2011 at 5:11 pm

    How can i upload this gallery on my site plz help me….

  41. 45 Fume hood May 30, 2011 at 4:13 pm

    Very nice. Lovely image galleries, these increase my workflow.

  42. 46 Ewwggecb September 23, 2011 at 10:02 pm

    I’m sorry, I didn’t catch your name Pussy Hussyfan
    :) )

  43. 47 Oyalufuq September 25, 2011 at 4:58 am

    Could you tell me the number for ? 3d Bikini Models
    :-]]

  44. 48 Kyryl November 26, 2011 at 12:30 pm

    How can I add next and previous buttons? please help

  45. 49 Rose January 13, 2012 at 10:47 am

    Hello…Not sure if you are still answering questions to this post…One question: How can I change the spacing between the images in actionscript? Thank you.

  46. 51 saadat March 16, 2012 at 10:57 am

    SIR its not wroking even i have changed the link frm local host m testing it to my local machine but not displaying pic


  1. 1 Free Flash Applications :Image Galeries, FLV Players, MP3 Players | Flex Tech Trackback on June 9, 2008 at 8:02 pm
  2. 2 Christian Web Design Resources » Blog Archive » Free Flash Resources Trackback on August 29, 2008 at 2:32 am
  3. 3 Free Flash Resources | Christian Web Design Tutorials Trackback on August 29, 2008 at 4:13 am
  4. 4 Free Flash Resources | Christian Web Design Blog Trackback on September 3, 2008 at 6:10 am
  5. 5 Ücretsiz Resim Galerileri Üzerine Bir İnceleme | Away4m Trackback on January 11, 2009 at 10:18 pm
  6. 6 2010 in review « Cyberspace Nova Trackback on January 2, 2011 at 11:37 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s




Info

Blog of Aleksandar Gvozden Technical director of MADEBYPLAY

Welcome and enjoy... more updates coming soon!

Catch me on
Twitter
LinkedIn
Facebook


CU3ER - 3D Image Slider

Twitter

Tags


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: