«

»

Apr 01

Simple Xml Photo Gallery (Swishmax 4 Tutorial)

Example:

First Of All

Open Swishmax 2, 3 or 4 and set the movie properties as follows width = 527 Height = 410 Frame rate = 25 swf export = swf8

 

Step.1

insert 2 empty movieclips one at the top of the stage named thumbnails and the other center stage named loader.
On Scene_1 place the following code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
onFrame (1) {
myPhoto = new XML();
myPhoto.ignoreWhite = true;
myPhoto.onLoad = function(success) {
    numimages = this.firstChild.childNodes.length;
    spacing = 70;
    for (i=0; i<numimages; i++) {
        this.picHolder = this.firstChild.childNodes[i];
        this.thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i);
        this.thumbHolder._x = i*spacing;
        this.thumbLoader = this.thumbHolder.createEmptyMovieClip("thumbnail_image", 0);
        this.thumbLoader.loadMovie(this.picHolder.attributes.thmb);
        this.thumbHolder.title = this.picHolder.attributes.title;
        this.thumbHolder.main = this.picHolder.attributes.main;
        this.thumbHolder.onRelease = function() {
            loader.loadMovie(this.main);
            title_txt.text = this.title;
            marker._x=this._x+27;
            marker._y=this._y+9;
        };
    }
};
myPhoto.load("xmlphoto.xml");
}

Step.2
using the Rectangle tool make a small rectangle select it as a target and name it marker place it off stage.

now do the same again create a small square / rectangle and name it shaddow i have had a solid white fill colour this time and no outline. place this off stage.

Step.3
Open a text editor like Notepad and place the following xml code into it and save as xmlphoto.xml

1
2
3
4
5
6
7
8
9
<gallery>
<img title="Photo Name Here" alt="" />
<img title="Photo Name Here" alt="" />
<img title="Photo Name Here" alt="" />
<img title="Photo Name Here" alt="" />
<img title="Photo Name Here" alt="" />
<img title="Photo Name Here" alt="" />
<img title="Photo Name Here" alt="" />
</gallery>

make sure everything is in the same folder export the movie swf & html and test.

you can purchase the tutorials files if you wish for Swishmax 4
Price £3.00


VN:F [1.9.22_1171]
Rating: 5.0/5 (2 votes cast)
VN:F [1.9.22_1171]
Rating: +3 (from 3 votes)
Simple Xml Photo Gallery (Swishmax 4 Tutorial), 5.0 out of 5 based on 2 ratings

3 comments

  1. Craig Lowe

    if you are looking for a photo gallery that will realy make life simple.
    take a look at my free swishmax 4 slideshow component.
    Simple Slidesho v1 Swishmax 4 component
    Or
    Simple Slidesho v2 Swishmax 4 component

    VN:F [1.9.22_1171]
    Rating: 5.0/5 (1 vote cast)
    VN:F [1.9.22_1171]
    Rating: +1 (from 1 vote)
  2. jorgeica

    Hello, very nice tutorial,
    I buy it, thanks

    Question, as I make small images are 20?.

    means leaving in 2 rows.

    thanks and sorry for the translation, my mail is ica_soft@hotmail.com

    VN:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  3. Craig Lowe

    yes could do 2 rows or you could add images into a small thumbnail scroller.
    have you looked at my slideshow component for swishmax 4
    http://www.swish-designs.co.uk/blog/?p=3464

    VN:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    Rating: 0 (from 0 votes)

Leave a Reply

7 visitors online now
2 guests, 5 bots, 0 members
Max visitors today: 12 at 03:43 am UTC
This month: 27 at 05-17-2013 01:24 pm UTC
This year: 39 at 01-01-2013 12:46 pm UTC
All time: 109 at 12-07-2012 11:00 pm UTC