Photo Album with external images

 

The purpose is to create a photo album with imported images on the fly from a directory inside animation.
This example 'll use pretty complex scripts. I suppose you know well how to create objects, thus I will not insist on.
On other hand, I 'll not answer to any question for that example. It's up to you to make an effort; I believe my explanations are enough. If you don't have any knowledge in programming, good luck.

⇒ animation ⇐

Warning :
This example 'll use a PHP script (server side).
Then, to test your creation, you 'll need :
- either an Apache web server set on your computer ( with PHP installed )
- either put your files on your web directory , provide that your host allows PHP scripting.

At first, Download a zip file (15 JPG images). 
Unzip the file in a directory you 'll name imageflash.

Aims

In a 320x240 scene, we gonna put a set of 4 images.
I do put 15 JPG images 120x90 in the directory to make the job harder.
So we'll get 4 pages, but the last one 'll have only 3 images.
2 buttons 'll enable to go forth and back thru pages.
As soon as you click an image, it will zoom to the whole scene.
A button 'll allow to get back to the page with 4 images.

Remarks :
320 / 240 = 120 / 90 = 4/3 , to get a nice zoom which keeps ratio.
Swishmax rejects to import gif mages in dynamic mode whereas they are in static mode. (bug?)

Creating Objects

1 - Set up width 320, height 240, and background color #CC9900.
Frame Rate doesn't matter.

2 - Now create a rectangle, color #666600, named rect1.
You'll yield, for instance :

Rectangle    Transform

This rectangle 'll be the shadow of an image.
Position and size don't matter. Only Name, toggled Target and anchor point Top Left are significant.

3 - Then create 3 other rectangles : rect2, rect3, rect4
Position and size don't matter. Only Name, toggled Target and anchor point Top Left are significant.

4 - Insert a Sprite; name it Sprite1.
You'll yield, for instance :

Sprite    Transform

This sprite will store an image.
Position and size don't matter. Only Name, toggled Target and anchor point Top Left are significant.

5 - In the same way, insert 3 other sprites : Sprite2, Sprite3, Sprite4
Position and size don't matter. Only Name, toggled Target and anchor point Top Left are significant.

6 - Insert a button; name it Button1.
You'll yield, for instance :

Bouton    Transform

This button enables zoom of a selected image.
Position and size don't matter. Only Name, toggled Target and anchor point Top Left are significant.

7 - In the same way, insert 3 other buttons : Button2, Button3, Button4
Position and size don't matter. Only Name, toggled Target and anchor point Top Left are significant.

8 - Create a text Page précédente (green color)
Convert it to a button; name itPrev

Bouton    Transform

You can decorate Over, Down, Up states.

9 - Create a textPage suivante (green color)
Convert it to a button; name it Next

Bouton    Transform

Scene

You can decorate Over, Down, Up states.

10 - Create a text Retour (blue color)
Convert it to a button; name it Retour

Bouton    Transform

Scene

You can decorate Over, Down, Up states.

In Timeline, set Place in Frame 10 of row Retour.

Outline

Outline 'd look like to :

Outline

PHP Script

With your favourite text editor, enter the following script :

Save as readir.php. You'll need it on the server.

Explanations :
We scan the directory /imageflash. While there are files in this directory, we 'll get width and height of images but, at end, we 'll only get the lowest ones.
( Anyway, that doesn't matter right here, all images are same )
The content of variables nb_total_image , largeur_min_image , hauteur_min_image , fini 'll be read by SwishMax script.

SwishMax Scripts

Here is Scene_1 script.

Here is Button1 script.

Copy and paste that script for Button2, Button3, Button4 but you need to change
rectK, spriteK, current_image = K avec K = 2 , 3 , 4.

Here is Prev button script.

Here is Next button script.

Here is Retour button script.

 


Si vous aimez le site

 

Select a language if you need :


Page chargée en 0.004 sec.

Dernière Modification : Mer 25 Janvier 2017 8:56
Copyright © 1999-2017 Jean-Paul Molina Tous droits réservés.

to Google