1 //
2 // Description:
3 //    SlideShow Test
4 //
5 // Authors:
6 //    Jonathan Shore <jshore@e-shuppan.com>
7 //
8 // Copyright:
9 //    Copyright 2001 E-Publishing Group Inc.  Permission is granted to use or
10 //    modify this code provided that the original copyright notice is included.
11 //
12 //    This software is distributed with no warranty of liability, merchantability,
13 //    or fitness for a specific purpose.
14 //
15 
16 
17 //
18 //  SlideShow Test
19 //      flip between two slides, first slide alpha transitioned
20 //
21 //  Notes
22 //    - substitute with your own jpgs (and dimensions)
23 //
24 public class SlideShow {
25 
GetImage(String file, int width, int height)26     private static SWFShape GetImage (String file, int width, int height)
27 	throws SWFException
28     {
29 	SWFShape image = new SWFShape ();
30 
31 	// do fill (red)
32 	SWFFillI f = image.addBitmapFill (new SWFBitmap (file), SWFFillI.ClippedBitmap);
33 	image.setRightFill (f);
34 
35 	// create box
36 	image.movePenTo (0,0);
37 	image.drawLineTo (width,0);
38 	image.drawLineTo (width,height);
39 	image.drawLineTo (0,height);
40 	image.drawLineTo (0,0);
41 
42 	return image;
43     }
44 
45 
main(String[] argv)46     public static void main (String[] argv)
47         throws Exception
48     {
49 	SWFShape Ia = GetImage ("images/Burberry-h1.jpg", 524, 800);
50 	SWFShape Ib = GetImage ("images/Burberry-h2.jpg", 524, 800);
51 
52 	// add box to movie clip
53 	SWFMovieClip clip = new SWFMovieClip ();
54 
55 	SWFDisplayItemI Da = clip.add(Ia, 1);
56 	Da.setAlpha (0);
57 	SWFDisplayItemI Db = clip.add(Ib, 2);
58 	Db.setAlpha (0);
59 
60 	for (int i = 0 ; i < 20; i++) {
61 	    Da.setAlpha ((255/20)*i);
62 	    clip.nextFrame();
63 	}
64 
65 	Db.setAlpha (255);
66 	for (int i = 0 ; i < 20; i++) clip.nextFrame();
67 
68 	// create movie
69 	SWFMovie movie = new SWFMovie();
70 	movie.setBackground(0xff, 0xff, 0xff);
71 	movie.setDimension(524,800);
72 
73 	// add movie clip to main movie and position
74 	SWFDisplayItemI Citem = movie.add (clip, 1);
75 	Citem.moveTo(0,0);
76 
77 	// save to file
78 	movie.save ("images.swf");
79     }
80 };
81